public static bool HasMasterAccess([NotNull] this IProjectEntity entity, int?currentUserId) { if (entity == null) { throw new ArgumentNullException(nameof(entity)); } return(entity.HasMasterAccess(currentUserId, acl => true)); }
public static void RequestMasterAccess(this IProjectEntity field, int currentUserId) { if (field == null) { throw new ArgumentNullException(nameof(field)); } if (field.Project == null) { throw new ArgumentNullException(nameof(field.Project)); } if (!field.HasMasterAccess(currentUserId)) { throw new NoAccessToProjectException(field.Project, currentUserId); } }
public static void RequestMasterAccess(this IProjectEntity field, int?currentUserId, Expression <Func <ProjectAcl, bool> > lambda) { if (field == null) { throw new ArgumentNullException(nameof(field)); } if (field.Project == null) { throw new ArgumentNullException(nameof(field.Project)); } if (!field.HasMasterAccess(currentUserId, acl => lambda.Compile()(acl))) { throw new NoAccessToProjectException(field.Project, currentUserId, lambda); } }
public static bool HasEditRolesAccess(this IProjectEntity character, int?currentUserId) { return(character.HasMasterAccess(currentUserId, s => s.CanEditRoles) && character.Project.Active); }