Esempio n. 1
0
        /// <summary>
        /// Updates a Permission
        /// </summary>
        /// <param name="permission">The permission being updated</param>
        /// <param name="roleName">The name of the role</param>
        /// <param name="roleid">The id of the role</param>
        /// <param name="allowAccess">The value of the permission</param>
        protected override void UpdatePermission(PermissionInfo permission, int roleid, string roleName, bool allowAccess)
        {
            bool isMatch = false;
            ModulePermissionInfo objPermission;
            int permissionId = permission.PermissionID;

            //Search ModulePermission Collection for the permission to Update
            foreach (ModulePermissionInfo tempLoopVar_objPermission in ModulePermissions)
            {
                objPermission = tempLoopVar_objPermission;
                if (objPermission.PermissionID == permissionId && objPermission.RoleID == roleid)
                {
                    //ModulePermission is in collection
                    if (!allowAccess)
                    {
                        //Remove from collection as we only keep AllowAccess permissions
                        ModulePermissions.Remove(objPermission);
                    }
                    isMatch = true;
                    break;
                }
            }

            //ModulePermission not found so add new
            if (!isMatch && allowAccess)
            {
                objPermission = new ModulePermissionInfo();
                objPermission.PermissionID = permissionId;
                objPermission.RoleName     = roleName;
                objPermission.RoleID       = roleid;
                objPermission.AllowAccess  = allowAccess;
                objPermission.ModuleID     = ModuleID;
                ModulePermissions.Add(objPermission);
            }
        }
Esempio n. 2
0
 protected override void RemovePermission(int permissionID, int roleID, int userID)
 {
     _ModulePermissions.Remove(permissionID, roleID, userID);
     //Clear Permission List
     _PermissionsList = null;
 }
Esempio n. 3
0
 protected override void RemovePermission(int permissionID, int roleID, int userID)
 {
     _ModulePermissions.Remove(permissionID, roleID, userID);
 }