public int RevokeAll(string organizeId)
        {
            List <KeyValuePair <string, object> > parameters = new List <KeyValuePair <string, object> >
            {
                new KeyValuePair <string, object>(PiPermissionScopeTable.FieldResourceCategory, PiOrganizeTable.TableName),
                new KeyValuePair <string, object>(PiPermissionScopeTable.FieldResourceId, organizeId)
            };
            PiPermissionScopeManager permissionScopeManager = new PiPermissionScopeManager(DBProvider, UserInfo, this.CurrentTableName);

            return(permissionScopeManager.Delete(parameters));
        }
Example #2
0
        public int RevokeAll(string userId)
        {
            string[] names  = new string[2];
            string[] values = new string[2];
            names[0]  = PiPermissionScopeTable.FieldResourceCategory;
            values[0] = PiUserTable.TableName;
            names[1]  = PiPermissionScopeTable.FieldResourceId;
            values[1] = userId;
            PiPermissionScopeManager permissionScopeManager = new PiPermissionScopeManager(DBProvider, UserInfo);

            return(permissionScopeManager.Delete(names, values));
        }
        public int ClearOrganizePermissionScope(string organizeId, string permissionItemCode)
        {
            List <KeyValuePair <string, object> > parameters = new List <KeyValuePair <string, object> >
            {
                new KeyValuePair <string, object>(PiPermissionScopeTable.FieldResourceCategory, PiOrganizeTable.TableName),
                new KeyValuePair <string, object>(PiPermissionScopeTable.FieldResourceId, organizeId),
                new KeyValuePair <string, object>(PiPermissionScopeTable.FieldPermissionId, this.GetIdByCode(permissionItemCode))
            };

            PiPermissionScopeManager permissionScopeManager = new PiPermissionScopeManager(DBProvider, UserInfo, this.CurrentTableName);

            return(permissionScopeManager.Delete(parameters));
        }
        //
        //  撤销授权范围的实现部分
        //

        #region private int RevokeModule(PiPermissionScopeManager permissionScopeManager, string organizeId, string permissionItemCode, string revokeModuleId) 为了提高授权的运行速度
        /// <summary>
        /// 为了提高授权的运行速度
        /// </summary>
        /// <param name="permissionScopeManager">权限域读写器</param>
        /// <param name="organizeId">组织机构主键</param>
        /// <param name="permissionItemCode">权限代码</param>
        /// <param name="revokeModuleId">回收的模块主键</param>
        /// <returns>主键</returns>
        private int RevokeModule(PiPermissionScopeManager permissionScopeManager, string organizeId, string permissionItemCode, string revokeModuleId)
        {
            List <KeyValuePair <string, object> > parameters = new List <KeyValuePair <string, object> >
            {
                new KeyValuePair <string, object>(PiPermissionScopeTable.FieldResourceCategory, PiOrganizeTable.TableName),
                new KeyValuePair <string, object>(PiPermissionScopeTable.FieldResourceId, organizeId),
                new KeyValuePair <string, object>(PiPermissionScopeTable.FieldTargetCategory, PiModuleTable.TableName),
                new KeyValuePair <string, object>(PiPermissionScopeTable.FieldTargetId, revokeModuleId),
                new KeyValuePair <string, object>(PiPermissionScopeTable.FieldPermissionId,
                                                  this.GetIdByCode(permissionItemCode))
            };

            return(permissionScopeManager.Delete(parameters));
        }
Example #5
0
        /// <summary>
        /// 清除用户权限范围
        /// </summary>
        /// <param name="userId">用户主键</param>
        /// <param name="permissionItemCode">操作权限编号</param>
        /// <returns>受影响的行数</returns>
        public int ClearUserPermissionScope(string userId, string permissionItemCode)
        {
            string[] names  = new string[3];
            string[] values = new string[3];
            names[0]  = PiPermissionScopeTable.FieldResourceCategory;
            values[0] = PiUserTable.TableName;
            names[1]  = PiPermissionScopeTable.FieldResourceId;
            values[1] = userId;
            names[2]  = PiPermissionScopeTable.FieldPermissionId;
            values[2] = this.GetIdByCode(permissionItemCode);

            PiPermissionScopeManager permissionScopeManager = new PiPermissionScopeManager(DBProvider, UserInfo);

            return(permissionScopeManager.Delete(names, values));
        }
Example #6
0
        //
        //  撤销授权范围的实现部分
        //

        #region private int RevokeUser(PiPermissionScopeManager permissionScopeManager, string roleId, string permissionItemCode, string revokeUserId) 为了提高授权的运行速度
        /// <summary>
        /// 为了提高授权的运行速度
        /// </summary>
        /// <param name="permissionScopeManager">权限域读写器</param>
        /// <param name="roleId">员工主键</param>
        /// <param name="permissionItemCode">权限代码</param>
        /// <param name="revokeUserId">权限主键</param>
        /// <returns>主键</returns>
        private int RevokeUser(PiPermissionScopeManager permissionScopeManager, string roleId, string permissionItemCode, string revokeUserId)
        {
            string[] names  = new string[5];
            string[] values = new string[5];
            names[0]  = PiPermissionScopeTable.FieldResourceCategory;
            values[0] = PiRoleTable.TableName;
            names[1]  = PiPermissionScopeTable.FieldResourceId;
            values[1] = roleId;
            names[2]  = PiPermissionScopeTable.FieldTargetCategory;
            values[2] = PiUserTable.TableName;
            names[3]  = PiPermissionScopeTable.FieldTargetId;
            values[3] = revokeUserId;
            names[4]  = PiPermissionScopeTable.FieldPermissionId;
            values[4] = this.GetIdByCode(permissionItemCode);
            return(permissionScopeManager.Delete(names, values));
        }