Exemple #1
0
        public RolePermissionCollection GetPermissionsByRole(Role role)
        {
            RolePermissionCollection rolePermissions = new RolePermissionCollection();

            for (int i = 0; i < permissions.Count; i++)
            {
                UserRolePermission rolePermission = permissions[i];
                if (rolePermission.Role.Equals(role))
                {
                    rolePermissions.AddPermission(rolePermission.Permission);
                }
            }
            return(rolePermissions);
        }
Exemple #2
0
        public RolePermissionCollection GetUnHavePermissionByRole(Role role)
        {
            RolePermissionCollection hadRolePermissions   = userRolePermissions.GetPermissionsByRole(role);
            RolePermissionCollection unHadRolePermissions = new RolePermissionCollection();

            for (int i = 0; i < role.Permissions.Count; i++)
            {
                Permission permission = role.Permissions[i];
                if (!hadRolePermissions.HavePermission(permission))
                {
                    unHadRolePermissions.AddPermission(permission);
                }
            }
            return(unHadRolePermissions);
        }