From 74a94a09bc62f5d93c1eb95dad696d15718b11e7 Mon Sep 17 00:00:00 2001 From: John Woodlock Date: Mon, 28 May 2012 14:07:44 +1000 Subject: [PATCH] api docs update and order list users by user_id --- APIFolder/api.htm | 51 +++++++++---------- APIFolder/docUpdateComments.txt | 5 ++ .../AppUserReadPlatformServiceImpl.java | 2 +- 3 files changed, 29 insertions(+), 29 deletions(-) diff --git a/APIFolder/api.htm b/APIFolder/api.htm index 59e68e5eb..cd1ecbc06 100644 --- a/APIFolder/api.htm +++ b/APIFolder/api.htm @@ -3094,20 +3094,22 @@ No Request Body

Create new user

-

Adds new application user to the platform.

+

Adds new application user.

POST https://thedomainname/api/v1/users POST https://localhost:8443/mifosng-provider/api/v1/users Content-Type: application/json Request body: -{ - "officeId": 1, - "username": "newuser1", - "firstname": "Test", - "lastname": "User", - "email": "demomfi@mifos.org", - "selectedItems": ["1"] +{ + "username": "Another New User zll", + "firstname": "Test", + "lastname": "User", + "password": "window75", + "repeatPassword": "window75f", + "email": "whatever@mifos.org", + "officeId": 1, + "roles": ["2","3"] } @@ -3122,25 +3124,20 @@ Request body:

Update existing user

-

Update details of an existing application user.

- PUT https://thedomainname/api/v1/users/11 -PUT https://localhost:8443/mifosng-provider/api/v1/users/11 + PUT https://thedomainname/api/v1/users/{userId) +PUT https://localhost:8443/mifosng-provider/api/v1/users/3 Content-Type: application/json -Request body: -{ - "officeId": 1, - "username": "newuser123", - "firstname": "Test", - "lastname": "User", - "email": "demomfi@mifos.org", - "selectedItems": ["1"] +Request body:{ + "firstname": "Test", + "roles": ["2"] } + { - "entityId": 11 + "entityId": 3 }
@@ -3149,18 +3146,16 @@ Request body:  
-

Delete existing user

-

Delete reference to application user on platform.

+

Delete a User

+

Removes the user and the associated roles and permissions.

- DELETE https://thedomainname/api/v1/users/11 -DELETE https://localhost:8443/mifosng-provider/api/v1/users/11 + DELETE https://thedomainname/api/v1/users/{userId} +DELETE https://localhost:8443/mifosng-provider/api/v1/users/20 Content-Type: application/json +No Request Body - -{ - "entityId": 11 -} +Question outstanding
diff --git a/APIFolder/docUpdateComments.txt b/APIFolder/docUpdateComments.txt index d502e01aa..d79e21ec4 100644 --- a/APIFolder/docUpdateComments.txt +++ b/APIFolder/docUpdateComments.txt @@ -19,4 +19,9 @@ hierarchy update results in exception (prob solved by using unrecognized parame Users template: allowedOffices (only id 1 came back)... does allowedOffices and available Roles depending on requested permissions? Retrieve a user: selectedRoles- possible json prob availablePermissions is blank... is it always? +create new user... didn't check repeatPassword (see example in docs) but does in update + and msg shown on duplicate username isn't useful. + takes 4/5 seconds! +update: give hardtofigureout error msg when using equivalent to create parameters...worked ok with ones in docs tho. +delete: does delete (I delete super1), no 200 ok returned, "org.springframework.dao.InvalidDataAccessApiUsageException: attempt to create merge event with null entity; " if delete a non-existant user \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosng/platform/user/service/AppUserReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosng/platform/user/service/AppUserReadPlatformServiceImpl.java index 5e3454b11..c81b52331 100644 --- a/mifosng-provider/src/main/java/org/mifosng/platform/user/service/AppUserReadPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosng/platform/user/service/AppUserReadPlatformServiceImpl.java @@ -58,7 +58,7 @@ public class AppUserReadPlatformServiceImpl implements AppUserReadPlatformServic AppUserMapper mapper = new AppUserMapper(offices); String sql = "select " + mapper.schema() + " where u.org_id = ? and u.office_id in (" + officeIdsList - + ")"; + + ") order by u.id"; return this.jdbcTemplate.query(sql, mapper, new Object[] { currentUser .getOrganisation().getId() });