Beispiel #1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (unshareList.SelectedItems.Count <= 0)
            {
                MessageBox.Show("请选择要共享的用户!", "文档管理系统", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (!addReadBox.Checked && !addWriteBox.Checked)
            {
                MessageBox.Show("请选择共享权限!", "文档管理系统", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            foreach (ListViewItem item in unshareList.SelectedItems)
            {
                try
                {
                    CUserEntity user = (CUserEntity)(item.Tag);
                    if (addReadBox.Checked)
                    {
                        _currentUser.Permit(user.Usr_Id, ACLROLETYPE.USERROLE, _resourceId, ACLOPERATION.READ);
                    }
                    if (addWriteBox.Checked)
                    {
                        _currentUser.Permit(user.Usr_Id, ACLROLETYPE.USERROLE, _resourceId, ACLOPERATION.WRITE);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("无法共享:" + ex.Message, "文档管理系统", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }

            // refill user lists
            FillUserLists();
        }