| | |
| | | $('#nutzerRolleEntziehen').prop( "disabled", true ); |
| | | $('#rolleErteilen').prop( "disabled", true ); |
| | | $('#rolleErteilen').click(um_grant_role); |
| | | $('#nutzerRolleEntziehen').click(um_revoke_role); |
| | | $('#neueRolle').click(um_new_role); |
| | | $('#rollen').click(um_role_list_click); |
| | | $('#nutzerrollen').click(um_user_role_list_click); |
| | |
| | | } |
| | | } |
| | | |
| | | function um_revoke_role() { |
| | | var userId = um_get_first_selected_user_id(); |
| | | var roleId = um_get_first_selected_userrole_id(); |
| | | if(roleId !== 'none' && userId !== 'none') { |
| | | um_apicall_revoke_role(userId, roleId); |
| | | } |
| | | } |
| | | |
| | | /* ----------- ui interaction ------------ */ |
| | | |
| | | function um_user_list_click() { |
| | |
| | | var roleId = 'none'; |
| | | var roleIds = []; |
| | | $('#rollen :selected').each(function(i, selected){ |
| | | roleIds[i] = $(selected).text(); |
| | | }); |
| | | if(roleIds.length > 0) { |
| | | roleId = roleIds[0]; |
| | | } |
| | | return roleId; |
| | | } |
| | | |
| | | function um_get_first_selected_userrole_id() { |
| | | var roleId = 'none'; |
| | | var roleIds = []; |
| | | $('#nutzerrollen :selected').each(function(i, selected){ |
| | | roleIds[i] = $(selected).text(); |
| | | }); |
| | | if(roleIds.length > 0) { |
| | |
| | | }); |
| | | } |
| | | |
| | | function um_apicall_revoke_role(userId, roleName) { |
| | | var m = 'revokeRole'; |
| | | var u = '../svc/' + m; |
| | | $.ajax({ |
| | | url: u, |
| | | data: { |
| | | p1: userId, |
| | | p2: roleName |
| | | }, |
| | | type: "POST", |
| | | dataType : "html", |
| | | success: function( resp ) { |
| | | um_apicall_get_user_roles(userId); |
| | | }, |
| | | error: function( xhr, status, errorThrown ) { |
| | | $('#fehler').html("Error: " + errorThrown + " Status: " + status); |
| | | }, |
| | | complete: function( xhr, status ) { |
| | | //alert( "The request is complete!" ); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | //public List getUserRoleNames(String userId) |
| | | function um_apicall_get_user_roles(userId) { |
| | | var m = 'getUserRoleNames'; |