public bool IsAvailableForUser(UserBase user, ScenarioStartupSource source, ScenarioAction action) { if (action > DenyAction) { return(true); } return(source != ScenarioStartupSource.SystemUI); }
public ScenarioBase[] GetScenarios(UserBase user, ScenarioStartupSource source, ScenarioAction action, ValueTypeBase valueType = null, bool rightPart = false) { var actionSource = new ScenarioActionSource(user, source, ScenarioAction.ViewValue); return(Scenarios.Where(x => (valueType == null || valueType.IsCompatibleWith(x.ValueType)) && x.IsAccessAvailable(actionSource) && (rightPart ? !(x.ValueType is ButtonValueType) : true)) .ToArray()); }
public bool IsAvailableForUser(UserBase user, ScenarioStartupSource source, ScenarioAction action) { if (action > DenyAction) { return(true); } if (user is SystemUser) { return(true); } return(UsersIds.Any(x => x.Equals(user.Id))); }
public bool IsAvailableForUser(UserBase user, ScenarioStartupSource source, ScenarioAction action) { if (action > DenyAction) { return(true); } if (user is SystemUser) { return(true); } return(!GroupsIds.Any(x => Repository.Groups.First(g => g.Name.Equals(x)) .UsersIds.Any(z => z.Equals(user.Id)))); }
public override bool IsAvailableForUser(UserBase user, ScenarioStartupSource source, ScenarioAction action) { if (source == ScenarioStartupSource.System) { return(true); } var result = true; foreach (var permission in Permissions) { result &= permission.IsAvailableForUser(user, source, action); } return(result); }
private string GetStartupSourceName(ScenarioStartupSource source) { switch (source) { case ScenarioStartupSource.Network: return("Сеть"); case ScenarioStartupSource.OtherScenario: return("Другой сценарий"); case ScenarioStartupSource.System: return("Система"); case ScenarioStartupSource.SystemUI: return("Системный интерфейс"); } throw new InvalidOperationException("Неизвестный источник запуска"); }
public abstract bool IsAvailableForUser(UserBase user, ScenarioStartupSource source, ScenarioAction action);
public ScenarioActionSource(UserBase user, ScenarioStartupSource source, ScenarioAction action) { User = user; Source = source; Action = action; }