Exemplo n.º 1
0
        public static ISecurityUserWithRoles GetAnonymousUser(this XpandRole systemRole)
        {
            var optionsAthentication = ((IModelOptionsAuthentication)ApplicationHelper.Instance.Application.Model.Options).Athentication;
            var anonymousUserName    = optionsAthentication.AnonymousAuthentication.AnonymousUser;

            return(GetAnonymousUser(systemRole, anonymousUserName));
        }
Exemplo n.º 2
0
 private void ApproveAuditsActionPermission(XpandRole userRole){
     var actionStateRulePermission = ObjectSpace.CreateObject<ActionStateOperationPermissionData>();
     actionStateRulePermission.ObjectTypeData = typeof (object);
     actionStateRulePermission.ActionId = AuditPendingController.ApproveAudits;
     actionStateRulePermission.ActionState = ActionState.Hidden;
     actionStateRulePermission.ID = "Hide ApproveAudits";
     userRole.Permissions.Add(actionStateRulePermission);
 }
Exemplo n.º 3
0
        void CreateMemberLevelSecurityObjectPermissions(XpandRole securityDemoRole) {
            //We want to selectively assign Read/Write permission to members of MemberLevelSecurityObject class, so first we create a type permission that allows everything except Read/Write
            var memberLevelTypePermission = securityDemoRole.CreateTypePermission<MemberLevelSecurityObject>(o => {
                o.AllowCreate = true;
                o.AllowDelete = true;
                o.AllowNavigate = true;
            }, false);

            //Only for ReadWriteProperty,Name members we overwrite the Read/Write permissions we got from the TypePermission. All other members members will inherit permissions from the TypePermission Read/Write ==false
            memberLevelTypePermission.CreateMemberPermission(o => {
                o.AllowRead = true;
                o.AllowWrite = true;
                o.Members = "ReadWriteProperty; Name";
            }, false);

            //Maybe this is not needed
            memberLevelTypePermission.CreateMemberPermission(o => o.Members = "ProtectedContentProperty; ProtectedContentCollection", false);

            //Only for ReadWriteProperty,Name members we overwrite the Read/Write permissions we got from the TypePermission. All other members members will inherit permissions from the TypePermission Read ==false
            memberLevelTypePermission.CreateMemberPermission(o => {
                o.AllowRead = true;
                o.Members = "ReadOnlyProperty; ReadOnlyCollection";
            }, false);
        }
Exemplo n.º 4
0
        void CreateNavigateObjectLevelSecurityObjectPermissions(XpandRole securityDemoRole) {
            //We want to allow operations for objects that fit in a criterion, so first we create a TypePermission that allows no operation except Navigate
            var navigateObjectLevelSecurityObjectTypePermission = securityDemoRole.CreateTypePermission<ObjectLevelSecurityObject>(o => {
                o.AllowNavigate = true;
            }, false);

            //We create an ObjectPermission that allows all operations for ObjectLevelSecurityObjects that fit to [Name] Like '%Fully Accessible%'
            navigateObjectLevelSecurityObjectTypePermission.CreateObjectPermission(
                o => { o.Criteria = "[Name] Like '%Fully Accessible%'"; });

            //We create an ObjectPermission that allows only Navigate for ObjectLevelSecurityObjects that fit to [Name] Like '%Protected%'
            navigateObjectLevelSecurityObjectTypePermission.CreateObjectPermission(o => {
                o.AllowNavigate = true;
                o.Criteria = "[Name] Like '%Protected%'";
            }, false);

            //We create an ObjectPermission that allows only Navigate/Read for ObjectLevelSecurityObjects that fit to [Name] Like '%Read-Only%''
            navigateObjectLevelSecurityObjectTypePermission.CreateObjectPermission(o => {
                o.Criteria = "[Name] Like '%Read-Only%'";
                o.AllowNavigate = true;
                o.AllowRead = true;
            }, false);

            //We create an ObjectPermission that allows only Navigate/Read/Write for ObjectLevelSecurityObjects that fit to [Name] Like '%Read-Only%''
            navigateObjectLevelSecurityObjectTypePermission.CreateObjectPermission(o => {
                o.Criteria = "[Name] Like '%Protected Deletion%'";
                o.AllowNavigate = true;
                o.AllowRead = true;
                o.AllowWrite = true;
            }, false);
        }
Exemplo n.º 5
0
 public static ISecurityUserWithRoles GetAnonymousUser(this XpandRole systemRole, string userName)
 {
     return(systemRole.GetUser(userName));
 }