maya
.public
Tables
(current)
Columns
Constraints
Relationships
Orphan Tables
Anomalies
Routines
ot_rw_createrole_useradmin(integer)
Parameters
Name
Type
Mode
_idclient
integer
IN
Definition
/* v20150501 RRB Create an admin user with the most common set of privileges for such role v20150606 RRB Create and admin role based on the account's privilegegroup */ DECLARE _idrole INTEGER; _idprivilegegroup INTEGER; BEGIN SELECT idprivilegegroup INTO _idprivilegegroup FROM client WHERE idclient = _idclient; SELECT idrole INTO _idrole FROM role WHERE idclient = _idclient AND lower(name) = 'admin'; IF NOT FOUND THEN INSERT INTO role (idrole,idclient,name,createbyuser,creationdate,lastmodifiedbyuser,lastmodificationdate,originatingsystem,enabled) VALUES(nextval('sec_role'),_idclient,'admin',0,now(),0,now(),'DBA',true); INSERT INTO role_privilege(idrole,idprivilege) SELECT currval('sec_role'),idprivilege FROM privilege_privilegegroup WHERE idprivilegegroup = _idprivilegegroup ; END IF; /* return the id of the newly created role or the pre-existing */ RETURN coalesce(_idrole,currval('sec_role')); END