public bool CanDelete(CosmosDocument entity) { if (entity.IsSystemType() || entity.Owner == GlobalDataSettings.SystemOwnerName) { return(false); } if (IsAdmin()) { return(true); } return(entity.Owner == Id); }
public bool CanUpdate(CosmosDocument entity, List <string> shares) { if (entity.Type == "account" && Id == entity.Id) { return(true); } if (IsAdmin()) { return(true); } return(CanRead(entity, shares)); }
public bool CanRead(CosmosDocument entity, List <string> shares) { if (IsAdmin()) { return(true); } var groups = GetGroups(); if (entity.Owner == Id || shares.Contains(entity.Owner) || shares.Contains(entity.Id) || entity.Participants.Any(participant => participant.Id == Id)) { return(true); } if (entity.Type == "account") { return(entity.GetPropertyValue <List <string> >("groups").Any(group => groups.Contains(group))); } return(false); }