salix/db/changes/10221-accountModule/00-myUser_hasRole.sql

18 lines
469 B
SQL

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;