|
|
@@ -660,7 +660,36 @@ o2.xDesktop.Default = new Class({
|
|
|
};
|
|
|
},
|
|
|
created: function() {
|
|
|
- _self.org.listRoleWithPerson(_self.session.user.id, true).then(function(res){
|
|
|
+ function listRoleWithPerson(name, async){
|
|
|
+ MWF.require("MWF.xScript.Actions.UnitActions", null, false);
|
|
|
+ var orgActions = new MWF.xScript.Actions.UnitActions();
|
|
|
+ var getNameFlag = function(name){
|
|
|
+ var t = typeOf(name);
|
|
|
+ if (t==="array"){
|
|
|
+ var v = [];
|
|
|
+ name.each(function(id){
|
|
|
+ v.push((typeOf(id)==="object") ? (id.distinguishedName || id.id || id.unique || id.name) : id);
|
|
|
+ });
|
|
|
+ return v;
|
|
|
+ }else{
|
|
|
+ return [(t==="object") ? (name.distinguishedName || name.id || name.unique || name.name) : name];
|
|
|
+ }
|
|
|
+ };
|
|
|
+ var data = {"personList": getNameFlag(name)};
|
|
|
+
|
|
|
+ var v = null;
|
|
|
+ var cb = function(json){
|
|
|
+ v = json.data;
|
|
|
+ return v;
|
|
|
+ };
|
|
|
+
|
|
|
+ var promise = orgActions.listRoleWithPerson(data, cb, null, !!async);
|
|
|
+ return (!!async) ? promise : v;
|
|
|
+ // var v = null;
|
|
|
+ // orgActions.listRoleWithPerson(data, function(json){v = json.data;}, null, false);
|
|
|
+ // return v;
|
|
|
+ }
|
|
|
+ listRoleWithPerson(_self.session.user.id, true).then(function(res){
|
|
|
let where = res.map(function(i) {
|
|
|
return "o.role = '" + i.unique + "'"
|
|
|
}).join(' or ');
|