| | |
| | | return roleId; |
| | | } |
| | | |
| | | // {"List":[{"List":[{"String":"ROLE_NAME"},{"String":"testrolle1"}]}]} |
| | | function um_show_user_role_list(resp) { |
| | | $("#nutzerrollen").empty(); |
| | | var rollen = resp.List[0]; |
| | |
| | | $("#nutzerrollen").append('<option value=' + rolle.String + '>' + rolle.String + '</option>'); |
| | | } |
| | | $('#nutzerRolleEntziehen').prop( "disabled", true ); |
| | | $('#rolleErteilen').prop( "disabled", true ); |
| | | } |
| | | |
| | | function um_show_role_list(resp) { |
| | |
| | | var rolle = rollen.List[i]; |
| | | $("#rollen").append('<option value=' + rolle.String + '>' + rolle.String + '</option>'); |
| | | } |
| | | //$('#neueRolle').prop( "disabled", true ); |
| | | $('#rolleErteilen').prop( "disabled", true ); |
| | | } |
| | | |
| | |
| | | type: "POST", |
| | | dataType : "html", |
| | | success: function( resp ) { |
| | | //$('#fehler').html('Antwort: ' + resp); |
| | | um_apicall_get_user_list(); |
| | | um_back_from_new_user(); |
| | | }, |
| | |
| | | }); |
| | | } |
| | | |
| | | // public UserRole grantRole(String userId, String roleName) |
| | | // http]://example.com/um/api?c=de.uhilger.um.api.UserMgr&m=testmethode |
| | | function um_apicall_grant_role(userId, roleName, isNewRole) { |
| | | var ur = new UserRole(userId, roleName); |
| | | var m = 'grantRole'; |
| | | var u = '../svc/' + m; |
| | | $.ajax({ |
| | | url: u, |
| | | data: { |
| | | p1: userId, |
| | | p2: roleName |
| | | p: self.serialisieren(ur) |
| | | }, |
| | | type: "POST", |
| | | dataType : "html", |
| | |
| | | } |
| | | |
| | | function um_apicall_revoke_role(userId, roleName) { |
| | | var ur = new UserRole(userId, roleName); |
| | | var m = 'revokeRole'; |
| | | var u = '../svc/' + m; |
| | | $.ajax({ |
| | | url: u, |
| | | data: { |
| | | p1: userId, |
| | | p2: roleName |
| | | p: self.serialisieren(ur) |
| | | }, |
| | | type: "POST", |
| | | dataType : "html", |
| | |
| | | }); |
| | | } |
| | | |
| | | //public List getUserRoleNames(String userId) |
| | | function um_apicall_get_user_roles(userId) { |
| | | var m = 'getUserRoleNames'; |
| | | var u = '../svc/' + m + '?p=' + userId; |
| | |
| | | type: "GET", |
| | | dataType : "json", |
| | | success: function( resp ) { |
| | | // Antwort in Liste anzeigen |
| | | um_show_user_role_list(resp); |
| | | }, |
| | | error: function( xhr, status, errorThrown ) { |
| | |
| | | type: "GET", |
| | | dataType : "json", |
| | | success: function( resp ) { |
| | | // Antwort in Liste anzeigen |
| | | um_show_role_list(resp); |
| | | }, |
| | | error: function( xhr, status, errorThrown ) { |
| | |
| | | this.firstName = fn; |
| | | this.lastName = ln; |
| | | this.email = em; |
| | | } |
| | | |
| | | function UserRole(u, r) { |
| | | this.userId = u; |
| | | this.role = r; |
| | | } |