示例#1
0
        public static bool HasPermission(PermissionsEnum permissionsEnum, User user)
        {
            var permission = PermissionsMapper.GetPermissionsFromEnum(permissionsEnum);

            if (permission == null)
            {
                return(false);
            }

            var roles = RolesMapper.FilterWithPermission(user.Roles, permission);

            return(roles.Any());
        }
示例#2
0
 public static IEnumerable <Permission> GetNotInRolesPermissions(User user, IMediaDetail mediaDetail)
 {
     return(PermissionsMapper.FilterOutList(PermissionsMapper.GetAllActive(), GetUserRolesPermissions(user, mediaDetail)));
 }