public static string GetUsersViewItem(RestCommand command, int userID) { UsersViewItem usersViewItem = UsersView.GetUsersViewItem(command.LoginUser, userID); if (usersViewItem.OrganizationID != command.Organization.OrganizationID) { throw new RestException(HttpStatusCode.Unauthorized); } return(usersViewItem.GetXml("UsersViewItem", true)); }
public static string DeleteUser(RestCommand command, int userID) { UsersViewItem user = UsersView.GetUsersViewItem(command.LoginUser, userID); if (user == null) { throw new RestException(HttpStatusCode.BadRequest); } Organization organization = Organizations.GetOrganization(command.LoginUser, user.OrganizationID); if (organization.OrganizationID != command.Organization.OrganizationID) { throw new RestException(HttpStatusCode.Unauthorized); } string result = user.GetXml("User", true); Users.MarkUserDeleted(command.LoginUser, userID); return(result); }