X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=security%2Fruntime%2Forg.argeo.security.ria%2Fsrc%2Fargeo-ria-lib%2Fsecurity%2Fclass%2Forg%2Fargeo%2Fsecurity%2Fria%2Fmodel%2FUser.js;fp=security%2Fruntime%2Forg.argeo.security.ria%2Fsrc%2Fargeo-ria-lib%2Fsecurity%2Fclass%2Forg%2Fargeo%2Fsecurity%2Fria%2Fmodel%2FUser.js;h=0000000000000000000000000000000000000000;hb=0ceaef8eb3172da98031699fc3d306c6816fea44;hp=c5185355b3ff336152d64c8c7684ec7881ccaa42;hpb=9b6a0645e8e964fd7bb04a63ddebbf2f14bd7779;p=lgpl%2Fargeo-commons.git diff --git a/security/runtime/org.argeo.security.ria/src/argeo-ria-lib/security/class/org/argeo/security/ria/model/User.js b/security/runtime/org.argeo.security.ria/src/argeo-ria-lib/security/class/org/argeo/security/ria/model/User.js deleted file mode 100644 index c5185355b..000000000 --- a/security/runtime/org.argeo.security.ria/src/argeo-ria-lib/security/class/org/argeo/security/ria/model/User.js +++ /dev/null @@ -1,91 +0,0 @@ -qx.Class.define("org.argeo.security.ria.model.User", { - extend : qx.core.Object, - properties : { - name : { - init : "", - check : "String" - }, - password : { - nullable : true, - check : "String" - }, - roles : { - check : "Array" - }, - natures :{ - check : "Array" - }, - rawData : { - - }, - create : { - check : "Boolean", - init : true - } - }, - construct : function(){ - this.base(arguments); - this.setRoles([]); - this.setNatures([]); - this.setRawData({password:null}); - }, - members : { - load : function(data, format){ - this.setCreate(false); - this.setName(data.username); - this.setRoles(data.roles); - this.setNatures(data.userNatures); - this.setRawData(data); - }, - getSaveService : function(self){ - if(this.isCreate()){ - var userService = org.argeo.security.ria.SecurityAPI.getCreateUserService(this.toJSON(true)); - }else{ - var userService = org.argeo.security.ria.SecurityAPI.getUpdateUserService(this.toJSON(), self); - } - userService.addListener("completed", function(response){ - if(!response || !response.username) return; - this.load(response.getContent(), "json"); - }, this); - return userService; - }, - toJSON : function(create){ - var rawData = this.getRawData(); - rawData.username = this.getName(); - rawData.roles = this.getRoles(); - rawData.userNatures = this.getNatures(); - if(create) rawData.password = this.getPassword(); - return rawData; - }, - _getNatureByType : function(natureType){ - var found = false; - this.getNatures().forEach(function(el){ - if(el.type == natureType){ - found = el; - } - }); - return found; - }, - addNature : function(nature){ - if(this._getNatureByType(nature.type)){ - return; - } - this.getNatures().push(nature); - }, - removeNature : function(natureType){ - var foundNature = this._getNatureByType(natureType) - if(foundNature){ - qx.lang.Array.remove(this.getNatures(), foundNature); - } - }, - updateNature : function(nature){ - var natures = this.getNatures(); - for(var i=0;i