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"); }
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); }