Ejemplo n.º 1
0
 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)
     });
 }
Ejemplo n.º 2
0
 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()
     });
 }
Ejemplo n.º 3
0
 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()
     });
 }
Ejemplo n.º 4
0
        protected override bool AuthorizeCore(System.Web.HttpContextBase httpContext)
        {
            if (!CurrentRequestData.CurrentUser.IsActive)
            {
                return(false);
            }
            ACLRule aclRule = (Activator.CreateInstance(_type) as ACLRule);

            return(aclRule != null && aclRule.CanAccess(CurrentRequestData.CurrentUser, _operation, null));
        }
Ejemplo n.º 5
0
 public static ACLOption Create(ACLRule rule, string operation)
 {
     return(new ACLOption {
         Operation = operation, Rule = rule
     });
 }