예제 #1
0
        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));
        }
예제 #2
0
        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);
        }