Example #1
0
        private void btnCopy_Click(object sender, EventArgs e)
        {
            var permissionScopes = new PermissionScopes();

            // 模块访问权限复制到剪切板
            for (int i = 0; i < this.cklstUser.CheckedItems.Count; i++)
            {
                var userEntity = BaseEntity.Create <PiUserEntity>(((System.Data.DataRowView) this.cklstUser.CheckedItems[i]).Row);
                this.GrantUsers += userEntity.Id.ToString() + ";";
            }
            var grantUserIds = this.GrantUsers.Split(';');

            permissionScopes.GrantUserIds = grantUserIds;

            for (int i = 0; i < this.cklstRole.CheckedItems.Count; i++)
            {
                var roleEntity = BaseEntity.Create <PiRoleEntity>(((System.Data.DataRowView) this.cklstRole.CheckedItems[i]).Row);
                this.GrantRoles += roleEntity.Id.ToString() + ";";
            }
            string[] grantRoleIds = this.GrantRoles.Split(';');
            permissionScopes.GrantRoleIds = grantRoleIds;

            string[] grantOrganizeIds = this.GetGrantOrganizeIds();
            permissionScopes.GrantOrganizeIds = grantOrganizeIds;
            string[] grantModuleIds = this.GetGrantModuleIds();
            permissionScopes.GrantModuleIds = grantModuleIds;
            string[] grantPermissionIds = this.GetGrantPermissionIds();
            permissionScopes.GrantPermissionIds = grantPermissionIds;
            Clipboard.SetData("permissionScopes", permissionScopes);
            this.btnPaste.Enabled = true;
        }
Example #2
0
        private void btnPaste_Click(object sender, EventArgs e)
        {
            object clipboardData = Clipboard.GetData("permissionScopes");

            if (clipboardData != null)
            {
                PermissionScopes permissionScopes = (PermissionScopes)clipboardData;
                string[]         grantUserIds     = permissionScopes.GrantUserIds;
                RDIFrameworkService.Instance.PermissionService.GrantUserUserScope(this.UserInfo, this.TargetUserId, this.PermissionItemScopeCode, grantUserIds);
                string[] grantRoleIds = permissionScopes.GrantRoleIds;
                RDIFrameworkService.Instance.PermissionService.GrantUserRoleScope(this.UserInfo, this.TargetUserId, this.PermissionItemScopeCode, grantRoleIds);
                string[] grantOrganizeIds = permissionScopes.GrantOrganizeIds;
                RDIFrameworkService.Instance.PermissionService.GrantUserOrganizeScope(this.UserInfo, this.TargetUserId, this.PermissionItemScopeCode, grantOrganizeIds);
                string[] grantModuleIds = permissionScopes.GrantModuleIds;
                RDIFrameworkService.Instance.PermissionService.GrantUserModuleScope(this.UserInfo, this.TargetUserId, this.PermissionItemScopeCode, grantModuleIds);
                string[] grantPermissionIds = permissionScopes.GrantPermissionIds;
                RDIFrameworkService.Instance.PermissionService.GrantUserPermissionItemScope(this.UserInfo, this.TargetUserId, this.PermissionItemScopeCode, grantPermissionIds);

                this.GetCurrentPermission();
            }
        }