Esempio n. 1
0
        public bool UserHasGroupAccess(string groupSlug, Guid userId)
        {
            if (string.IsNullOrWhiteSpace(groupSlug))
            {
                throw new ArgumentNullException(nameof(groupSlug));
            }
            if (Guid.Empty == userId)
            {
                throw new ArgumentOutOfRangeException(nameof(groupSlug));
            }

            var(MembershipRole, GroupRole) = GetUserRoles(groupSlug, userId);

            return(MembershipRole?.ToLower() == "admin" || GroupRole?.ToLower() == "admin" || GroupRole?.ToLower() == "standard members");
        }
Esempio n. 2
0
        public async Task <bool> UserHasFileAccessAsync(Guid fileId, Guid userId, CancellationToken cancellationToken)
        {
            var(MembershipRole, GroupRole, IsPublic) = await GetUserRolesForFileAsync(fileId, userId, cancellationToken);

            return(MembershipRole?.ToLower() == "admin" || GroupRole?.ToLower() == "admin" || GroupRole?.ToLower() == "standard members" || IsPublic);
        }