18 lines
469 B
MySQL
18 lines
469 B
MySQL
|
DROP FUNCTION IF EXISTS account.myUser_hasRole;
|
||
|
|
||
|
DELIMITER $$
|
||
|
CREATE DEFINER=`root`@`%` FUNCTION `account`.`myUser_hasRole`(vRoleName VARCHAR(255)) RETURNS tinyint(1)
|
||
|
DETERMINISTIC
|
||
|
BEGIN
|
||
|
/**
|
||
|
* Checks if current user has/inherits a role.
|
||
|
*
|
||
|
* @param vRoleName Role to check
|
||
|
* @return %TRUE if it has role, %FALSE otherwise
|
||
|
*/
|
||
|
RETURN user_hasRole(myUser_getName(), vRoleName);
|
||
|
END$$
|
||
|
DELIMITER ;
|
||
|
|
||
|
GRANT EXECUTE ON FUNCTION account.myUser_hasRole TO guest@localhost;
|