salix/db/routines/account/functions/myUser_hasPriv.sql

19 lines
557 B
MySQL
Raw Normal View History

DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `account`.`myUser_hasPriv`(vChain VARCHAR(100),
vPrivilege ENUM('SELECT','INSERT','UPDATE','DELETE')
)
RETURNS tinyint(1)
NOT DETERMINISTIC
READS SQL DATA
BEGIN
/**
* Search if my user has privileges on table or column
*
* @param vChain string passed with this syntax dbName.tableName[.columnName]
* @param vPrivilege privileges to check ('SELECT','INSERT','UPDATE','DELETE')
* @return vHasPrivilege
*/
RETURN user_hasPriv(vChain, vPrivilege, myUser_getId());
END$$
DELIMITER ;