Example #1
0
        public void UpdateSecurityEntryTest()
        {
            string name = Constants.AF_SECURITY_IDENTITY_NAME;
            PIItemsSecurityEntry securityEntries = null;

            securityEntries = instance.GetSecurityEntries(webId, name, null);
            if ((securityEntries == null) || (securityEntries.Items.Count == 0))
            {
                CreateSecurityEntryTest();
                securityEntries = instance.GetSecurityEntries(webId, name, null);
            }

            PISecurityEntry securityEntry = securityEntries.Items.First();

            securityEntry.AllowRights = new List <string>()
            {
                "ReadWrite", "Delete", "Execute", "Admin", "Subscribe", "ReadWriteData"
            };
            securityEntry.DenyRights = new List <string>()
            {
                "SubscribeOthers", "Annotate", "None"
            };
            securityEntry.Name  = null;
            securityEntry.Links = null;
            securityEntry.SecurityIdentityName = null;
            bool?applyToChildren = null;

            instance.UpdateSecurityEntry(webId: webId, name: name, securityEntry: securityEntry, applyToChildren: applyToChildren);

            PIItemsSecurityEntry securityEntries2 = instance.GetSecurityEntries(webId, name, null);

            Assert.IsTrue(securityEntry.AllowRights.Count == securityEntries2.Items.First().AllowRights.Count);
        }
Example #2
0
        public void DeleteSecurityEntryTest()
        {
            string name = Constants.AF_SECURITY_IDENTITY_NAME;
            PIItemsSecurityEntry securityEntryItems = null;

            try
            {
                securityEntryItems = instance.GetSecurityEntryByName(name, webId, null);
            }
            catch (Exception)
            {
                if (securityEntryItems == null)
                {
                    CreateSecurityEntryTest();
                }
            }
            bool?applyToChildren = null;

            instance.DeleteSecurityEntry(webId: webId, name: name, applyToChildren: applyToChildren);
            var secEntry = instance.GetSecurityEntries(webId).Items.Where(m => m.Name == name).FirstOrDefault();

            Assert.IsNull(secEntry);
        }
Example #3
0
 public ApiResponsePIItemsSecurityEntry(int statusCode, IDictionary <string, string> headers, PIItemsSecurityEntry data)
     : base(statusCode, headers)
 {
     this.Data = data;
 }