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); }
/// <summary>Create a security entry owned by the element category.</summary> public ApiResponseObject CreateSecurityEntryWithHttpInfo(string webId, PISecurityEntry securityEntry, bool applyToChildren) { if (string.IsNullOrEmpty(webId)==true) { webId = null; } if (webId == null) throw new ApiException(400, "Missing required parameter 'webId'"); if (securityEntry == null) throw new ApiException(400, "Missing required parameter 'securityEntry'"); var localVarPath = "/elementcategories/{webId}/securityentries"; var localVarPathParams = new Dictionary<String, String>(); var localVarQueryParams = new CustomDictionaryForQueryString(); var localVarHeaderParams = new Dictionary<String, String>(Configuration.DefaultHeader); var localVarFormParams = new Dictionary<String, String>(); var localVarFileParams = new Dictionary<String, FileParameter>(); Object localVarPostBody = null; String[] localVarHttpContentTypes = new String[] { }; String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); String[] localVarHttpHeaderAccepts = new String[] { "application/json", "text/json", "text/xml" }; String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); localVarPathParams.Add("format", "json"); if (webId!= null) localVarPathParams.Add("webId", Configuration.ApiClient.ParameterToString(webId)); if (securityEntry != null && securityEntry.GetType() != typeof(byte[])) { localVarPostBody = Configuration.ApiClient.Serialize(securityEntry); } else { localVarPostBody = securityEntry; } localVarQueryParams.Add("applyToChildren", Configuration.ApiClient.ParameterToString(applyToChildren)); IRestResponse localVarResponse = (IRestResponse)Configuration.ApiClient.CallApi(localVarPath, Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarPathParams, localVarHttpContentType); int localVarStatusCode = (int)localVarResponse.StatusCode; if (ExceptionFactory != null) { Exception exception = ExceptionFactory("CreateSecurityEntry", localVarResponse); if (exception != null) throw exception; } return new ApiResponseObject(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), (Object)Configuration.ApiClient.Deserialize(localVarResponse, typeof(Object))); }
public void CreateSecurityEntryTest() { PISecurityEntry securityEntry = new PISecurityEntry(); securityEntry.SecurityIdentityName = Constants.AF_SECURITY_IDENTITY_NAME; securityEntry.AllowRights = new List <string>() { "ReadWrite", "Delete", "Execute", "Admin" }; securityEntry.DenyRights = new List <string>() { "ReadWriteData", "Subscribe", "SubscribeOthers", "Annotate", "None" }; bool?applyToChildren = null; instance.CreateSecurityEntry(webId, securityEntry, applyToChildren); var secEntry = instance.GetSecurityEntries(webId).Items.Where(m => m.Name == Constants.AF_SECURITY_IDENTITY_NAME).FirstOrDefault(); Assert.IsNotNull(secEntry); }
public void CreateSecurityEntryTest() { // TODO uncomment below to test the method and replace null with proper value PISecurityEntry securityEntry = new PISecurityEntry(); securityEntry.SecurityIdentityName = Constants.AF_SECURITY_IDENTITY_NAME; securityEntry.AllowRights = new List <string>() { "ReadWrite", "Delete", "Execute", "Admin" }; securityEntry.DenyRights = new List <string>() { "ReadWriteData", "Subscribe", "SubscribeOthers", "Annotate", "None" }; bool?applyToChildren = null; instance.CreateSecurityEntry(webId, securityEntry, applyToChildren); var secEntry = instance.GetSecurityEntries(webId).Items.Where(m => m.Name == Constants.AF_SECURITY_IDENTITY_NAME).FirstOrDefault(); Assert.IsNotNull(secEntry); // Assert.IsTrue(instance.GetSecurityEntries(webId).Items.Count == 5); }
public void DeleteSecurityEntryTest() { string name = Constants.AF_SECURITY_IDENTITY_NAME; PISecurityEntry securityEntry = null; try { securityEntry = instance.GetSecurityEntryByName(webId: webId, name: name); } catch (Exception) { if (securityEntry == 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); }
public void UpdateSecurityEntryTest() { string name = Constants.AF_SECURITY_IDENTITY_NAME; PISecurityEntry securityEntry = null; try { securityEntry = instance.GetSecurityEntryByName(webId: webId, name: name); } catch (Exception) { if (securityEntry == null) { CreateSecurityEntryTest(); } } securityEntry = instance.GetSecurityEntryByName(webId: webId, name: name); 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); PISecurityEntry securityEntryUpdated = instance.GetSecurityEntryByName(webId: webId, name: name); Assert.IsTrue(securityEntry.AllowRights.Count == securityEntryUpdated.AllowRights.Count); }
public ApiResponsePISecurityEntry(int statusCode, IDictionary <string, string> headers, PISecurityEntry data) : base(statusCode, headers) { this.Data = data; }
/// <summary>Update a security entry owned by the attribute category.</summary> public Object UpdateSecurityEntry(string name, string webId, PISecurityEntry securityEntry, bool applyToChildren) { ApiResponseObject localVarResponse = UpdateSecurityEntryWithHttpInfo(name, webId, securityEntry, applyToChildren); return(localVarResponse.Data); }
/// <summary>Create a security entry owned by the attribute category.</summary> public Object CreateSecurityEntry(string webId, PISecurityEntry securityEntry, bool applyToChildren, string webIdType = null) { ApiResponseObject localVarResponse = CreateSecurityEntryWithHttpInfo(webId, securityEntry, applyToChildren, webIdType); return(localVarResponse.Data); }