| | |
| | | function NutzerApp() { |
| | | var self = this; |
| | | //var appMenu; |
| | | var vorlagen; |
| | | //var api; |
| | | var userid; |
| | | //var pfad = ''; |
| | | var loc; |
| | | //var modus = 'kacheln'; |
| | | |
| | | this.init = function () { |
| | | self.vorlagen = new Vorlagen(); |
| | |
| | | self.loc = window.location.protocol + '//' + window.location.host; |
| | | }; |
| | | |
| | | this.datei_neuer_text = function () { |
| | | self.meldung_mit_timeout("Neuer Text", 1500); |
| | | }; |
| | | |
| | | /* Nutzerverwaltung */ |
| | | |
| | | this.nutzer_neu_dialog_zeigen = function () { |
| | |
| | | btn.addEventListener('click', self.nutzer_speichern); |
| | | } |
| | | }); |
| | | //self.menue_umschalten(); |
| | | }; |
| | | |
| | | this.nutzerliste_klick = function(event) { |
| | |
| | | } |
| | | target.classList.add("nutzer-gewaehlt"); |
| | | var nutzerId = target.innerHTML; |
| | | self.rollen_dialog_zeigen(nutzerId); |
| | | self.rollen_zeigen(nutzerId); |
| | | }; |
| | | |
| | | this.nutzer_speichern = function() { |
| | |
| | | |
| | | /* Rollen erteilen und entziehen */ |
| | | |
| | | this.rollen_dialog_zeigen = function(nutzerId) { |
| | | this.rollen_zeigen = function(nutzerId) { |
| | | var m = 'getUserRoleNames'; |
| | | var u = '../svc/' + m + '?p=' + nutzerId; |
| | | self.http_get(u, function (antwort) { |
| | | var jsonAntwort = JSON.parse(antwort); |
| | | var rollen = jsonAntwort.List[0]; |
| | | if(typeof rollen === 'object') { |
| | | rollen = jsonAntwort; |
| | | } else { |
| | | rollen = 'keine'; |
| | | } |
| | | self.vorlagen.html_erzeugen( |
| | | 'data/tpl/nutzer-rollen-dlg.tpl', |
| | | JSON.parse(antwort), |
| | | rollen, |
| | | function (html) { |
| | | document.querySelector("#nutzer").innerHTML = html; |
| | | document.querySelector("#nutzer-id").textContent = nutzerId; |
| | | self.addEvtListener('.granted-role-btn', 'click', self.revoke_role_klick); |
| | | var m = 'getRoleNamesGranted'; |
| | | var u = '../svc/' + m; |
| | | self.http_get(u, function (antwort2) { |
| | | self.vorlagen.html_erzeugen( |
| | | 'data/tpl/alle-rollen.tpl', |
| | | JSON.parse(antwort2), |
| | | function (html) { |
| | | document.querySelector(".alle-rollen-behaelter").innerHTML = html; |
| | | document.querySelector('.zurueck-btn').addEventListener('click', function (e) { |
| | | self.get_user_list(); |
| | | }); |
| | | self.addEvtListener('.avl-role-btn', 'click', self.grant_role_klick); |
| | | }); |
| | | }); |
| | | self.alle_rollen_zeigen(); |
| | | }); |
| | | }); |
| | | document.querySelector('.zurueck-btn').style.color = 'black'; |
| | | }; |
| | | |
| | | this.alle_rollen_zeigen = function() { |
| | | var m = 'getRoleNamesGranted'; |
| | | var u = '../svc/' + m; |
| | | self.http_get(u, function (antwort2) { |
| | | self.vorlagen.html_erzeugen( |
| | | 'data/tpl/alle-rollen.tpl', |
| | | JSON.parse(antwort2), |
| | | function (html) { |
| | | document.querySelector(".alle-rollen-behaelter").innerHTML = html; |
| | | document.querySelector('.zurueck-btn').addEventListener('click', function (e) { |
| | | self.get_user_list(); |
| | | }); |
| | | self.addEvtListener('.avl-role-btn', 'click', self.grant_role_klick); |
| | | }); |
| | | }); |
| | | }; |
| | | |
| | | this.grant_role_klick = function(event) { |
| | | self.alter_role(event, 'grantRole', function(roleId) { |
| | | var btn = document.createElement("button"); |