1 qx
.Class
.define("org.argeo.security.ria.SecurityAPI", {
2 extend
: qx
.core
.Object
,
5 DEFAULT_CONTEXT
: "/org.argeo.security.webapp",
7 USERS_LIST_SERVICE
: "getUsersList.security",
8 USER_EXISTS_SERVICE
: "userExists.security",
9 DELETE_USER_SERVICE
: "deleteUser.security",
10 GET_USER_DETAILS_SERVICE
: "getUserDetails.security",
11 CREATE_USER_SERVICE
: "createUser.security",
12 UPDATE_USER_PASS_SERVICE
: "updateUserPassword.security",
14 ROLES_LIST_SERVICE
: "getRolesList.security",
15 GET_USERS_ROLE_SERVICE
: "getUsersForRole.security",
16 CREATE_ROLE_SERVICE
: "createRole.security",
17 DELETE_ROLE_SERVICE
: "deleteRole.security",
19 UPDATE_USER_ROLE_LNK_SERVICE
: "updateUserRoleLink.security",
20 CREATE_NATURE_SERVICE
: "createUserNature.security",
21 DELETE_NATURE_SERVICE
: "deleteUserNature.security",
22 UPDATE_NATURE_SERVICE
: "updateUserNature.security",
25 * Standard Request getter
26 * @param serviceName {String} The name of the service to call (without base context)
27 * @param fireReloadEventType {String} Whether query should trigger a ReloadEvent
28 * @param iLoadStatusables {org.argeo.ria.components.ILoadStatusables[]} Gui parts to update
29 * @return {qx.io.remote.Request}
31 getServiceRequest : function(serviceName
) {
32 var serviceManager
= org
.argeo
.ria
.remote
.RequestManager
.getInstance();
33 return serviceManager
.getRequest(
34 org
.argeo
.security
.ria
.SecurityAPI
.DEFAULT_CONTEXT
+ "/" + serviceName
,
39 parseOptionalArguments : function(request
, argumentsArray
, startIndex
){
40 if(argumentsArray
.length
<= startIndex
) return;
41 var serviceManager
= org
.argeo
.ria
.remote
.RequestManager
.getInstance();
42 for(var i
=startIndex
;i
<argumentsArray
.length
;i
++){
43 var argument
= argumentsArray
[i
];
44 if(qx
.lang
.Array
.isArray(argument
)){
45 serviceManager
.attachILoadStatusables(request
, argument
);
46 }else if(typeof argument
== "string"){
47 serviceManager
.attachReloadEventType(request
, argument
);
53 * @return {qx.io.remote.Request}
55 getListUsersService : function(){
56 var req
= org
.argeo
.security
.ria
.SecurityAPI
.getServiceRequest(org
.argeo
.security
.ria
.SecurityAPI
.USERS_LIST_SERVICE
);
57 org
.argeo
.security
.ria
.SecurityAPI
.parseOptionalArguments(req
, arguments
, 1);
62 * @return {qx.io.remote.Request}
64 getUserExistsService : function(userName
){
65 var req
= org
.argeo
.security
.ria
.SecurityAPI
.getServiceRequest(org
.argeo
.security
.ria
.SecurityAPI
.USER_EXISTS_SERVICE
);
66 org
.argeo
.security
.ria
.SecurityAPI
.parseOptionalArguments(req
, arguments
, 1);
67 req
.addParameter("userName", userName
);
72 * @return {qx.io.remote.Request}
74 getDeleteUserService : function(userName
){
75 var req
= org
.argeo
.security
.ria
.SecurityAPI
.getServiceRequest(org
.argeo
.security
.ria
.SecurityAPI
.DELETE_USER_SERVICE
);
76 org
.argeo
.security
.ria
.SecurityAPI
.parseOptionalArguments(req
, arguments
, 1);
77 req
.addParameter("userName", userName
);
82 * @return {qx.io.remote.Request}
84 getUserDetailsService : function(userName
){
85 var req
= org
.argeo
.security
.ria
.SecurityAPI
.getServiceRequest(org
.argeo
.security
.ria
.SecurityAPI
.GET_USER_DETAILS_SERVICE
);
86 org
.argeo
.security
.ria
.SecurityAPI
.parseOptionalArguments(req
, arguments
, 1);
87 req
.addParameter("userName", userName
);
92 * @return {qx.io.remote.Request}
94 getCreateUserService : function(userName
){
95 var req
= org
.argeo
.security
.ria
.SecurityAPI
.getServiceRequest(org
.argeo
.security
.ria
.SecurityAPI
.CREATE_USER_SERVICE
);
96 org
.argeo
.security
.ria
.SecurityAPI
.parseOptionalArguments(req
, arguments
, 1);
97 req
.addParameter("userName", userName
);
102 * @return {qx.io.remote.Request}
104 getUpdateUserPassService : function(userName
, userPassword
){
105 var req
= org
.argeo
.security
.ria
.SecurityAPI
.getServiceRequest(org
.argeo
.security
.ria
.SecurityAPI
.UPDATE_USER_PASS_SERVICE
);
106 org
.argeo
.security
.ria
.SecurityAPI
.parseOptionalArguments(req
, arguments
, 1);
107 req
.addParameter("userName", userName
);
108 req
.addParameter("userPassword", userPassword
);
113 * @return {qx.io.remote.Request}
115 getListRolesService : function(){
116 var req
= org
.argeo
.security
.ria
.SecurityAPI
.getServiceRequest(org
.argeo
.security
.ria
.SecurityAPI
.ROLES_LIST_SERVICE
);
117 org
.argeo
.security
.ria
.SecurityAPI
.parseOptionalArguments(req
, arguments
, 1);
122 * @return {qx.io.remote.Request}
124 getUsersForRolesService : function(){
125 var req
= org
.argeo
.security
.ria
.SecurityAPI
.getServiceRequest(org
.argeo
.security
.ria
.SecurityAPI
.GET_USERS_ROLE_SERVICE
);
126 org
.argeo
.security
.ria
.SecurityAPI
.parseOptionalArguments(req
, arguments
, 1);
131 * @return {qx.io.remote.Request}
133 getCreateRoleService : function(roleName
){
134 var req
= org
.argeo
.security
.ria
.SecurityAPI
.getServiceRequest(org
.argeo
.security
.ria
.SecurityAPI
.CREATE_ROLE_SERVICE
);
135 org
.argeo
.security
.ria
.SecurityAPI
.parseOptionalArguments(req
, arguments
, 1);
140 * @return {qx.io.remote.Request}
142 getDeleteRoleService : function(roleName
){
143 var req
= org
.argeo
.security
.ria
.SecurityAPI
.getServiceRequest(org
.argeo
.security
.ria
.SecurityAPI
.DELETE_ROLE_SERVICE
);
144 org
.argeo
.security
.ria
.SecurityAPI
.parseOptionalArguments(req
, arguments
, 1);
149 * @return {qx.io.remote.Request}
151 getUpdateUserRoleLinkService : function(roleName
, userName
){
152 var req
= org
.argeo
.security
.ria
.SecurityAPI
.getServiceRequest(org
.argeo
.security
.ria
.SecurityAPI
.UPDATE_USER_ROLE_LNK_SERVICE
);
153 org
.argeo
.security
.ria
.SecurityAPI
.parseOptionalArguments(req
, arguments
, 1);
154 req
.addParameter("roleName", roleName
);
155 req
.addParameter("userName", userName
);
160 * @return {qx.io.remote.Request}
162 getCreateNatureService : function(natureData
){
163 var req
= org
.argeo
.security
.ria
.SecurityAPI
.getServiceRequest(org
.argeo
.security
.ria
.SecurityAPI
.CREATE_NATURE_SERVICE
);
164 org
.argeo
.security
.ria
.SecurityAPI
.parseOptionalArguments(req
, arguments
, 1);
165 req
.addParameter("natureData", natureData
);
170 * @return {qx.io.remote.Request}
172 getDeleteNatureService : function(natureUuid
){
173 var req
= org
.argeo
.security
.ria
.SecurityAPI
.getServiceRequest(org
.argeo
.security
.ria
.SecurityAPI
.DELETE_NATURE_SERVICE
);
174 org
.argeo
.security
.ria
.SecurityAPI
.parseOptionalArguments(req
, arguments
, 1);
175 req
.addParamter("natureUuid", natureUuid
);
180 * @return {qx.io.remote.Request}
182 getUpdateNatureService : function(natureUuid
, natureData
){
183 var req
= org
.argeo
.security
.ria
.SecurityAPI
.getServiceRequest(org
.argeo
.security
.ria
.SecurityAPI
.UPDATE_NATURE_SERVICE
);
184 org
.argeo
.security
.ria
.SecurityAPI
.parseOptionalArguments(req
, arguments
, 1);
185 req
.addParamter("natureUuid", natureUuid
);
186 req
.addParameter("natureData", natureData
);