public ExportColumn(string id, string title, Func <Contact, string> getter, PartAccess access) { Id = id; Title = title; Getter = getter; Access = access; }
private void Add(string id, string title, Func <Contact, string> getter, PartAccess access) { Columns.Add(new ExportColumn( id, _translator.Get("Export.Column." + id, "Column '" + id + "' in the export", title), getter, access)); }
private void AddPermission(Role role, SubjectAccess subject, PartAccess part, AccessRight right) { var permission = new Permission(Guid.NewGuid()); permission.Role.Value = role; permission.Subject.Value = subject; permission.Part.Value = part; permission.Right.Value = right; _db.Save(permission); }
public bool HasSystemWideAccess(PartAccess partAccess, AccessRight right) { var session = CurrentSession; if (session == null) { return(false); } else { return(session.HasSystemWideAccess(partAccess, right)); } }
public bool HasAccess(Group group, PartAccess partAccess, AccessRight right) { var session = CurrentSession; if (session == null) { return(false); } else { return(session.HasAccess(group, partAccess, right)); } }
public bool HasAccess(Contact contact, PartAccess partAccess, AccessRight right) { var session = CurrentSession; if (session == null) { return(false); } else { return(session.HasAccess(contact, partAccess, right)); } }
public static string Translate(this PartAccess part, Translator translator) { switch (part) { case PartAccess.None: return(translator.Get("Enum.PartAccess.None", "Value 'None' in PartAccess enum", "None")); case PartAccess.Contact: return(translator.Get("Enum.PartAccess.Contact", "Value 'Contact' in PartAccess enum", "Contact")); case PartAccess.Subscription: return(translator.Get("Enum.PartAccess.Subscription", "Value 'Subscription' in PartAccess enum", "Subscription")); case PartAccess.TagAssignments: return(translator.Get("Enum.PartAccess.TagAssignments", "Value 'TagAssignments' in PartAccess enum", "TagAssignments")); case PartAccess.RoleAssignments: return(translator.Get("Enum.PartAccess.RoleAssignments", "Value 'RoleAssignments' in PartAccess enum", "RoleAssignments")); case PartAccess.Structure: return(translator.Get("Enum.PartAccess.Structure", "Value 'Structure' in PartAccess enum", "Structure")); case PartAccess.CustomDefinitions: return(translator.Get("Enum.PartAccess.CustomDefinitions", "Value 'Custom definitions' in PartAccess enum", "Custom definitions")); case PartAccess.Demography: return(translator.Get("Enum.PartAccess.Demography", "Value 'Demography' in PartAccess enum", "Demography")); case PartAccess.Documents: return(translator.Get("Enum.PartAccess.Documents", "Value 'Documents' in PartAccess enum", "Documents")); case PartAccess.Mailings: return(translator.Get("Enum.PartAccess.Mailings", "Value 'Mailings' in PartAccess enum", "Mailings")); case PartAccess.Anonymous: return(translator.Get("Enum.PartAccess.Anonymous", "Value 'Anonymous' in PartAccess enum", "Anonymous")); case PartAccess.Journal: return(translator.Get("Enum.PartAccess.Journal", "Value 'Journal' in PartAccess enum", "Journal")); case PartAccess.Crypto: return(translator.Get("Enum.PartAccess.Crypto", "Value 'Crypto' in PartAccess enum", "Crypto")); case PartAccess.Deleted: return(translator.Get("Enum.PartAccess.Deleted", "Value 'Deleted' in PartAccess enum", "Deleted")); default: throw new NotSupportedException(); } }
public bool HasSystemWideAccess(PartAccess partAccess, AccessRight right) { foreach (var rolePermission in _access .Where(rp => rp.Permission.Part.Value == partAccess) .Where(rp => rp.Permission.Right.Value >= right)) { switch (rolePermission.Permission.Subject.Value) { case SubjectAccess.SystemWide: return(true); } } return(false); }
public bool HasAccess(Group group, PartAccess partAccess, AccessRight right) { foreach (var rolePermission in _access .Where(rp => rp.Permission.Part.Value == partAccess) .Where(rp => rp.Permission.Right.Value >= right)) { switch (rolePermission.Permission.Subject.Value) { case SubjectAccess.SystemWide: return(true); case SubjectAccess.Feed: if (rolePermission.Role.Group.Value.Feed.Value .Groups.Contains(group)) { return(true); } break; case SubjectAccess.SubFeed: if (rolePermission.Role.Group.Value.Feed.Value .Groups.Contains(group)) { return(true); } else if (rolePermission.Role.Group.Value.Feed.Value .Subordinates.SelectMany(o => o.Groups).Contains(group)) { return(true); } break; case SubjectAccess.Group: if (rolePermission.Role.Group.Value == group) { return(true); } break; } } return(false); }
public bool HasAccess(Contact contact, PartAccess partAccess, AccessRight right) { if ((partAccess != PartAccess.Deleted) && contact.Deleted && !HasAccess(contact, PartAccess.Deleted, right)) { return(false); } if (User == contact) { switch (partAccess) { case PartAccess.Anonymous: case PartAccess.Contact: return(true); case PartAccess.Demography: case PartAccess.Documents: case PartAccess.Subscription: case PartAccess.RoleAssignments: case PartAccess.TagAssignments: case PartAccess.Journal: if (right == AccessRight.Read) { return(true); } break; } } foreach (var subscription in contact.ActiveSubscriptions) { if (HasAccess(subscription.Feed.Value, partAccess, right)) { return(true); } } return(false); }
public bool HasSystemWideAccess(PartAccess partAccess, AccessRight right) { return(VerifyAccess(s => s.HasSystemWideAccess(partAccess, right))); }
public bool HasAccess(Group group, PartAccess partAccess, AccessRight right) { return(VerifyAccess(s => s.HasAccess(group, partAccess, right))); }
public bool HasAccess(Feed feed, PartAccess partAccess, AccessRight right) { return(VerifyAccess(s => s.HasAccess(feed, partAccess, right))); }
public bool HasAccess(Contact contact, PartAccess partAccess, AccessRight right) { return(VerifyAccess(s => s.HasAccess(contact, partAccess, right))); }
public PartManager(DbContextOptions <DomainModel.Models.CarMechanicContext> options) { _options = options; _partAccess = new PartAccess(_options); }
public bool HasAnyFeedAccess(PartAccess partAccess, AccessRight right) { return(VerifyAccess(s => s.HasAnyFeedAccess(partAccess, right))); }
public NamedIntViewModel(Translator translator, PartAccess part, bool selected) : this((int)part, part.Translate(translator), selected) { }