diversen opmerkingen

This commit is contained in:
2018-07-29 10:11:02 +02:00
parent cecbfd83fb
commit 30535f7048
34 changed files with 11883 additions and 82 deletions
@@ -9,6 +9,7 @@ dbo.authorisationInit = function () {
if ( dbo.authorisationModel !== undefined ) {
dbo.authorisationModel.refreshPageAuthorisations();
} else {
dbo.authorisationModel = {
@@ -22,10 +23,53 @@ dbo.authorisationInit = function () {
},
refreshPageAuthorisations: function () {
var vm = dbo.authorisationModel;
vm.initPages = true;
vm.roles.removeAll();
dbo.authorisationDataService.getRoleAuthorisations( function ( data ) {
console.log( data );
_.each( data, function ( p ) {
vm.roles.push( new vm.Role( p ) );
} )
} );
},
Role: function ( data ) {
var vm = dbo.authorisationModel;
var self = this;
self.roleID = data.id;
self.rolename = data.rolename;
self.pages = ko.observableArray( [] );
_.each( data.pagesAccess, function ( p ) {
self.pages.push( new vm.Page( p, self.pages() ) );
} );
vm.initPages = false;
},
Page: function ( data, pages ) {
var vm = dbo.authorisationModel;
var self = this;
if ( vm.initPages ) {
self.pageID = data.id;
self.pagename = data.pagename;
self.typePage = data.typepage;
self.pageAccess = ko.observableArray( [] );
self.pageAccess.push( {access: ko.observable( data.pageaccess == 'T' ? true : false )} );
}else{
_.each(pages, function(p){
console.log( pages );
console.log( data.id, '- -', p.pageID );
if( data.id == p.pageID) {
p.pageAccess.push( {access: ko.observable( data.pageaccess == 'T' ? true : false )} );
}
})
}
}
};