This commit is contained in:
Paula Quispe
2018-07-25 09:25:25 -04:00
parent 3d9380dbd6
commit 5d83768c3b
2 changed files with 55 additions and 42 deletions

View File

@@ -1323,6 +1323,33 @@ class RBAC
return $this->rolesObj->loadById($rolUid);
}
/**
* Get Role code
*
* @access public
*
* @param string $role
*
* @return string
*/
public function getRoleCodeValid($role)
{
$roleCode = '';
if (!empty($role)) {
if ($this->verifyByCode($role)) {
//If is a valid ROL_CODE
$roleCode = $role;
} else {
//We will to check by ROL_UID
$roleInfo = $this->loadById($role);
$roleCode = !empty($roleInfo['ROL_CODE']) ? $roleInfo['ROL_CODE'] : '';
}
}
return $roleCode;
}
/**
* this function gets the user's roles
*