maya
.public
Tables
(current)
Columns
Constraints
Relationships
Orphan Tables
Anomalies
Routines
ot_rw_createrole_viewuser(integer)
Parameters
Name
Type
Mode
_idclient
integer
IN
Definition
/* v20150409 RRB Create an admin user with the most common set of privileges for such role */ DECLARE _idrole INTEGER; BEGIN SELECT idrole INTO _idrole FROM role WHERE idclient = _idclient AND lower(name) = 'viewuser'; IF NOT FOUND THEN INSERT INTO role (idrole,idclient,name,createbyuser,creationdate,lastmodifiedbyuser,lastmodificationdate,originatingsystem,enabled) VALUES(nextval('sec_role'),_idclient,'viewuser',0,now(),0,now(),'DBA',true); INSERT INTO role_privilege(idrole,idprivilege) VALUES(currval('sec_role'),18), /* viewmonitor.visualizar */ (currval('sec_role'),29), /* viewalert.acceso a alertas */ (currval('sec_role'),31), /* viewcommand.visualizar estado de comandos */ (currval('sec_role'),34), /* viewdevice.acceso a dispositivos */ (currval('sec_role'),37), /* viewdriver.acceso a conductores */ (currval('sec_role'),50), /* viewmessage.acceso a mensajes */ (currval('sec_role'),52), /* viewmacros.acceso a macros */ (currval('sec_role'),56) /* viewdriverpref.acceso a preferencias del conductor */ ; END IF; /* return the id of the newly created role or the pre-existing */ RETURN coalesce(_idrole,currval('sec_role')); END