Subject | RE: [firebird-support] Current_User rights |
---|---|
Author | Simon Carter |
Post date | 2005-08-25T12:47:51Z |
> -----Original Message-----It depends what you call administrator rights. If you are not using your
> Could I also just check if the CURRENT_USER has
> administrative rights to a table and then just run a
> different query? If possible, how?
own "user rights" implementation then administrator could mean different
things. Perhaps a stored proc that checked to see if CURRENT_USER has
Insert, update, select, delete, reference and grant rights to a table would
give you what you need. The proviso being that any administrator must be
able to grant rights.
SET TERM ## ;
CREATE OR ALTER PROCEDURE USERHASGRANTOPTIONS(IPTABLENAME CHAR(31))
RETURNS (OPRESULT INTEGER)
AS
DECLARE VARIABLE REC_COUNT INTEGER;
BEGIN
SELECT COUNT(RDB$PRIVILEGE)
FROM RDB$USER_PRIVILEGES
WHERE RDB$PRIVILEGE IN ('S', 'I', 'U', 'D', 'R') AND
RDB$USER = CURRENT_USER AND
RDB$RELATION_NAME = :IPTABLENAME AND
RDB$GRANT_OPTION = 1
INTO REC_COUNT;
IF ((REC_COUNT IS NULL) OR (REC_COUNT <> 5)) THEN
OPRESULT = 0;
ELSE
OPRESULT = 1;
SUSPEND;
END ##
SET TERM ; ##
Hih
Si Carter
http://www.tectsoft.net/
http://www.fbtalk.net/