示例#1
0
        private void CreateClassLevelObjects()
        {
            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();
            }
        }
示例#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();
            }
        }