Exemple #1
0
        private void CreateMemberLevelObjects()
        {
            MemberLevelSecurityObject memberLevelSecurityObject = ObjectSpace.FindObject <MemberLevelSecurityObject>(new BinaryOperator("Name", "Member-Level Protected Object"));

            if (memberLevelSecurityObject == null)
            {
                memberLevelSecurityObject      = ObjectSpace.CreateObject <MemberLevelSecurityObject>();
                memberLevelSecurityObject.Name = "Member-Level Protected Object";
                memberLevelSecurityObject.ProtectedContentProperty = "Secure Property Value";
                memberLevelSecurityObject.ReadWriteProperty        = "Read Write Property Value";
                memberLevelSecurityObject.ReadOnlyProperty         = "Read Only Property Value";
                MemberLevelReferencedObject1 obj1 = ObjectSpace.CreateObject <MemberLevelReferencedObject1>();
                obj1.Name = "Referenced Object Type 1";
                obj1.Save();
                memberLevelSecurityObject.ProtectedContentCollection.Add(obj1);
                MemberLevelReferencedObject2 obj2 = ObjectSpace.CreateObject <MemberLevelReferencedObject2>();
                obj2.Name = "Referenced Object Type 2";
                obj2.Save();
                memberLevelSecurityObject.ReadOnlyCollection.Add(obj2);
                memberLevelSecurityObject.Save();
            }

            MemberLevelReferencedObject1 refObject = ObjectSpace.FindObject <MemberLevelReferencedObject1>(new BinaryOperator("Name", "Object 1"));

            if (refObject == null)
            {
                refObject      = ObjectSpace.CreateObject <MemberLevelReferencedObject1>();
                refObject.Name = "Object 1";
                ObjectSpace.CreateObject <MemberLevelReferencedObject1>().Name = "Object 2";
            }
            MemberByCriteriaSecurityObject fullAccessObjectObject = ObjectSpace.FindObject <MemberByCriteriaSecurityObject>(new BinaryOperator("Name", "Fully Accessible Property Object"));

            if (fullAccessObjectObject == null)
            {
                fullAccessObjectObject                   = ObjectSpace.CreateObject <MemberByCriteriaSecurityObject>();
                fullAccessObjectObject.Name              = "Fully Accessible Property Object";
                fullAccessObjectObject.Property1         = "Full Access";
                fullAccessObjectObject.ReferenceProperty = refObject;
            }
            MemberByCriteriaSecurityObject readOnlyObjectObject = ObjectSpace.FindObject <MemberByCriteriaSecurityObject>(new BinaryOperator("Name", "Read-Only Property Object"));

            if (readOnlyObjectObject == null)
            {
                readOnlyObjectObject                   = ObjectSpace.CreateObject <MemberByCriteriaSecurityObject>();
                readOnlyObjectObject.Name              = "Read-Only Property Object";
                readOnlyObjectObject.Property1         = "Read-Only";
                readOnlyObjectObject.ReferenceProperty = refObject;
            }
            MemberByCriteriaSecurityObject protectedContentObjectObject = ObjectSpace.FindObject <MemberByCriteriaSecurityObject>(new BinaryOperator("Name", "Protected Property Object"));

            if (protectedContentObjectObject == null)
            {
                protectedContentObjectObject                   = ObjectSpace.CreateObject <MemberByCriteriaSecurityObject>();
                protectedContentObjectObject.Name              = "Protected Property Object";
                protectedContentObjectObject.Property1         = "protected";
                protectedContentObjectObject.ReferenceProperty = refObject;
            }
            MemberByCriteriaSecurityObject noReadAccessObject = ObjectSpace.FindObject <MemberByCriteriaSecurityObject>(new BinaryOperator("Name", "No Read Access Object"));

            if (noReadAccessObject == null)
            {
                noReadAccessObject                   = ObjectSpace.CreateObject <MemberByCriteriaSecurityObject>();
                noReadAccessObject.Name              = "No Read Access Object";
                noReadAccessObject.Property1         = "No Read Access";
                noReadAccessObject.ReferenceProperty = refObject;
            }
        }
Exemple #2
0
        private void CreateSecurityDemoObjects()
        {
            FullAccessObject fullAccessObject = ObjectSpace.FindObject <FullAccessObject>(new BinaryOperator("Name", "Fully Accessible Object"));

            if (fullAccessObject == null)
            {
                fullAccessObject      = ObjectSpace.CreateObject <FullAccessObject>();
                fullAccessObject.Name = "Fully Accessible Object";
                fullAccessObject.Save();
            }
            ProtectedContentObject protectedContentObject = ObjectSpace.FindObject <ProtectedContentObject>(new BinaryOperator("Name", "Protected Object"));

            if (protectedContentObject == null)
            {
                protectedContentObject      = ObjectSpace.CreateObject <ProtectedContentObject>();
                protectedContentObject.Name = "Protected Object";
                protectedContentObject.Save();
            }
            ReadOnlyObject readOnlyObject = ObjectSpace.FindObject <ReadOnlyObject>(new BinaryOperator("Name", "Read-Only Object"));

            if (readOnlyObject == null)
            {
                readOnlyObject      = ObjectSpace.CreateObject <ReadOnlyObject>();
                readOnlyObject.Name = "Read-Only Object";
                readOnlyObject.Save();
            }

            IrremovableObject irremovableObject = ObjectSpace.FindObject <IrremovableObject>(new BinaryOperator("Name", "Protected Deletion Object"));

            if (irremovableObject == null)
            {
                irremovableObject      = ObjectSpace.CreateObject <IrremovableObject>();
                irremovableObject.Name = "Protected Deletion Object";
                irremovableObject.Save();
            }
            UncreatableObject uncreatableObject = ObjectSpace.FindObject <UncreatableObject>(new BinaryOperator("Name", "Protected Creation Object"));

            if (uncreatableObject == null)
            {
                uncreatableObject      = ObjectSpace.CreateObject <UncreatableObject>();
                uncreatableObject.Name = "Protected Creation Object";
                uncreatableObject.Save();
            }
            MemberLevelSecurityObject memberLevelSecurityObject = ObjectSpace.FindObject <MemberLevelSecurityObject>(new BinaryOperator("Name", "Member-Level Protected Object"));

            if (memberLevelSecurityObject == null)
            {
                memberLevelSecurityObject      = ObjectSpace.CreateObject <MemberLevelSecurityObject>();
                memberLevelSecurityObject.Name = "Member-Level Protected Object";
                memberLevelSecurityObject.ProtectedContentProperty = "Secure Property Value";
                memberLevelSecurityObject.ReadWriteProperty        = "Read Write Property Value";
                memberLevelSecurityObject.ReadOnlyProperty         = "Read Only Property Value";
                MemberLevelReferencedObject1 obj1 = ObjectSpace.CreateObject <MemberLevelReferencedObject1>();
                obj1.Name = "Referenced Object Type 1";
                obj1.Save();
                memberLevelSecurityObject.ProtectedContentCollection.Add(obj1);
                MemberLevelReferencedObject2 obj2 = ObjectSpace.CreateObject <MemberLevelReferencedObject2>();
                obj2.Name = "Referenced Object Type 2";
                obj2.Save();
                memberLevelSecurityObject.ReadOnlyCollection.Add(obj2);
                memberLevelSecurityObject.Save();
            }
            ObjectLevelSecurityObject fullAccessObjectObject = ObjectSpace.FindObject <ObjectLevelSecurityObject>(new BinaryOperator("Name", "Fully Accessible Object"));

            if (fullAccessObjectObject == null)
            {
                fullAccessObjectObject      = ObjectSpace.CreateObject <ObjectLevelSecurityObject>();
                fullAccessObjectObject.Name = "Fully Accessible Object";
                fullAccessObjectObject.Save();
            }
            ObjectLevelSecurityObject protectedContentObjectObject = ObjectSpace.FindObject <ObjectLevelSecurityObject>(new BinaryOperator("Name", "Protected Object"));

            if (protectedContentObjectObject == null)
            {
                protectedContentObjectObject      = ObjectSpace.CreateObject <ObjectLevelSecurityObject>();
                protectedContentObjectObject.Name = "Protected Object";
                protectedContentObjectObject.Save();
            }
            ObjectLevelSecurityObject readOnlyObjectObject = ObjectSpace.FindObject <ObjectLevelSecurityObject>(new BinaryOperator("Name", "Read-Only Object"));

            if (readOnlyObjectObject == null)
            {
                readOnlyObjectObject      = ObjectSpace.CreateObject <ObjectLevelSecurityObject>();
                readOnlyObjectObject.Name = "Read-Only Object";
                readOnlyObjectObject.Save();
            }
            ObjectLevelSecurityObject irremovableObjectObject = ObjectSpace.FindObject <ObjectLevelSecurityObject>(new BinaryOperator("Name", "Protected Deletion Object"));

            if (irremovableObjectObject == null)
            {
                irremovableObjectObject      = ObjectSpace.CreateObject <ObjectLevelSecurityObject>();
                irremovableObjectObject.Name = "Protected Deletion Object";
                irremovableObjectObject.Save();
            }
        }