コード例 #1
0
ファイル: Updater.cs プロジェクト: kevin3274/eXpand
        void CreateMemberLevelSecurityObjectPermissions(SecuritySystemRole 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);
        }
コード例 #2
0
ファイル: Updater.cs プロジェクト: kevin3274/eXpand
        void CreateNavigateObjectLevelSecurityObjectPermissions(SecuritySystemRole 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);
        }