phamtranquocviet
18 Feb 2012, 6:08 AM
Hi,
I am trying to implement access control for my web desktop. Each logged user has different menu under start button. Here is how I did it:
My login.php returns an array of class names to be loaded as module inside web desktop example like this: ["MyDesktop.VideoWindow", "MyDesktop.SystemStatus",...] <= this is the "acl" used below
I instantiate, apply the above array to the instantiated object, and modify getModules as followed:
desktop = Ext.create("MyDesktop.App");
Ext.apply(desktop, {acl: JSON.parse(acl).acl});
getModules : function(){
var modules = new Array();
for(i = 0; i < this.acl.length; i++) {
modules.push(Ext.create(this.acl[i]));
}
return modules;
},
That works fine when "requires" is static (requires: [classA, classB, ...]). However, how do I make the "requires" dynamically load classes returned by my login.php? Meaning, how do I do something like this:
requires: this.acl // Does not work because the above apply call is not yet executed at the time "requires" is trying to load.
Thanks.
I am trying to implement access control for my web desktop. Each logged user has different menu under start button. Here is how I did it:
My login.php returns an array of class names to be loaded as module inside web desktop example like this: ["MyDesktop.VideoWindow", "MyDesktop.SystemStatus",...] <= this is the "acl" used below
I instantiate, apply the above array to the instantiated object, and modify getModules as followed:
desktop = Ext.create("MyDesktop.App");
Ext.apply(desktop, {acl: JSON.parse(acl).acl});
getModules : function(){
var modules = new Array();
for(i = 0; i < this.acl.length; i++) {
modules.push(Ext.create(this.acl[i]));
}
return modules;
},
That works fine when "requires" is static (requires: [classA, classB, ...]). However, how do I make the "requires" dynamically load classes returned by my login.php? Meaning, how do I do something like this:
requires: this.acl // Does not work because the above apply call is not yet executed at the time "requires" is trying to load.
Thanks.