public bool IsReader() { return(EnvironmentResourceGroup.Any(p => ReaderRoles.Contains(p.Role)) && Batch.Any(p => ReaderRoles.Contains(p.Role)) && Storage.Any(p => ReaderRoles.Contains(p.Role)) && KeyVault.Any(p => ReaderRoles.Contains(p.Role)) && ApplicationInsights.Any(p => ReaderRoles.Contains(p.Role)) && VNet.Any(p => ReaderRoles.Contains(p.Role))); }
public bool IsOwner() { return(EnvironmentResourceGroup.Any(p => p.Role == OwnerRole) && Batch.Any(p => p.Role == OwnerRole) && Storage.Any(p => p.Role == OwnerRole) && KeyVault.Any(p => p.Role == OwnerRole) && ApplicationInsights.Any(p => p.Role == OwnerRole) && VNet.Any(p => p.Role == OwnerRole)); }
public UserPermission GetFirstUserPermission() { return(EnvironmentResourceGroup .Concat(Batch) .Concat(Storage) .Concat(KeyVault) .Concat(ApplicationInsights) .Concat(VNet) .FirstOrDefault()); }
public IEnumerable <string> GetUserObjectIds() { return(EnvironmentResourceGroup .Concat(Batch) .Concat(Storage) .Concat(KeyVault) .Concat(ApplicationInsights) .Concat(VNet) .Select(p => p.ObjectId) .ToHashSet()); }
// Returns the environment permissions for a given user public UserEnvironmentPermissions ToUserEnvironmentPermissions(string objectId) { return(new UserEnvironmentPermissions { EnvironmentResourceGroup = EnvironmentResourceGroup.Where(p => p.ObjectId == objectId).ToList(), Batch = Batch.Where(p => p.ObjectId == objectId).ToList(), Storage = Storage.Where(p => p.ObjectId == objectId).ToList(), KeyVault = KeyVault.Where(p => p.ObjectId == objectId).ToList(), ApplicationInsights = ApplicationInsights.Where(p => p.ObjectId == objectId).ToList(), VNet = VNet.Where(p => p.ObjectId == objectId).ToList(), }); }