18 lines
466 B
SQL
18 lines
466 B
SQL
DROP FUNCTION IF EXISTS account.myUser_hasRoleId;
|
|
|
|
DELIMITER $$
|
|
CREATE DEFINER=`root`@`%` FUNCTION `account`.`myUser_hasRoleId`(vRoleId INT) RETURNS tinyint(1)
|
|
DETERMINISTIC
|
|
BEGIN
|
|
/**
|
|
* Checks if current user has/inherits a role.
|
|
*
|
|
* @param vRoleName Role id to check
|
|
* @return %TRUE if it has role, %FALSE otherwise
|
|
*/
|
|
RETURN user_hasRoleId(myUserGetName(), vRoleId);
|
|
END$$
|
|
DELIMITER ;
|
|
|
|
GRANT EXECUTE ON FUNCTION account.myUser_hasRoleId TO guest@localhost;
|