public void TestRemoveProjectUser() { SecurityAction securityAction = new SecurityAction(ConnectString); System.Console.WriteLine(securityAction.RemoveProjectUser("TEST")); }
Core.ServiceResponse ISecurityService.RemoveProjectUser(SecurityServiceRequest securityServiceRequest) { if (string.IsNullOrEmpty(securityServiceRequest.Id) || string.IsNullOrEmpty(securityServiceRequest.Token) || string.IsNullOrEmpty(securityServiceRequest.Type)) { return new Core.ServiceResponse() { Code = 400, Message = "Id Type and Token should not null" }; } if (!securityServiceRequest.Type.Equals("Administrator") && !securityServiceRequest.Type.Equals("ProjectUser")) { return new Core.ServiceResponse() { Code = 400, Message = "Type should be Administrator or ProjectUser" }; } if (string.IsNullOrEmpty(securityServiceRequest.UserName)) { return new Core.ServiceResponse() { Code = 400, Message = "UserName should not null" }; } string message = string.Empty; if (HP.TS.Devops.Security.SecurityCode.Success != HP.TS.Devops.Security.SecurityAction.CheckAccess(this.ConnectString, securityServiceRequest, out message)) { return new Core.ServiceResponse() { Code = 403, Message = securityServiceRequest.Id + " of type " + securityServiceRequest.Type + " have no access of " + message }; } SecurityAction securityAction = new SecurityAction(this.ConnectString); if (securityAction.RemoveProjectUser(securityServiceRequest.UserName) <= 0) { return new Core.ServiceResponse() { Code = 500, Message = "Remove ProjectUser Fail" }; } return new Core.ServiceResponse() { Code = 0, Message = "Success" }; }