public static ACLAvailableModel Create(ACLRoleModel role, ACLRule rule, string operation, Type type) { return new ACLAvailableModel { Role = role, IsAllowed = rule.CanAccess(role.Role, operation, type == null ? null : type.FullName) }; }
public static ACLRuleOperationModel Create(List<ACLRoleModel> roles, ACLRule rule, ACLOperation operation, Type type) { return new ACLRuleOperationModel { DisplayName = operation.Name, Key = operation.Key, Roles = roles.Select(role => ACLAvailableModel.Create(role, rule, operation.Name, type)).ToList() }; }
public static ACLRuleModel Create(List<ACLRoleModel> roles, ACLRule rule, ACLGroup group) { return new ACLRuleModel { Name = group.Name, AppName = group.AppName, Operations = group.Operations.Select(operation => ACLRuleOperationModel.Create(roles, rule, operation, group.Type)).ToList() }; }
public static ACLOption Create(ACLRule rule, string operation) { return new ACLOption {Operation = operation, Rule = rule}; }