/// <summary> /// Delete the specified request. /// </summary> /// <param name="request">Request.</param> public object Delete(DomainDeleteRequest request) { var context = TepWebContext.GetWebContext(PagePrivileges.AdminOnly); try { context.Open(); context.LogInfo(this, string.Format("/domain/{{Id}} DELETE Id='{0}'", request.Id)); Domain domain = Domain.FromId(context, request.Id); if (context.UserLevel == UserLevel.Administrator) { domain.Delete(); } else { throw new UnauthorizedAccessException(CustomErrorMessages.ADMINISTRATOR_ONLY_ACTION); } context.LogDebug(this, string.Format("Domain {0} deleted by user {1}", domain.Identifier, User.FromId(context, context.UserId).Username)); context.Close(); } catch (Exception e) { context.LogError(this, e.Message, e); context.Close(); throw e; } return(new WebResponseBool(true)); }
public void Delete(string customerID, string domain) { using (PoolItem <DirectoryService> connection = this.directoryServicePool.Take(NullValueHandling.Ignore)) { DomainDeleteRequest request = new DomainDeleteRequest(connection.Item, domain, customerID); request.ExecuteWithRetryOnBackoff(); } }