Subject Re: [IBO] Handling user permissions
Author Dmitry Beloshistov
You also may check RDB$USER_PRIVILEGES for user permissions...

Example code:

with IB_Query1 do
begin
close; sql.clear;
sql.add('SELECT RDB$USER,RDB$PRIVILEGE,RDB$RELATION_NAME '+
'FROM RDB$USER_PRIVILEGES '+
'WHERE RDB$USER=:AUSER AND '+
'RDB$PRIVILEGE=:PERMISSION AND '+
'RDB$RELATION_NAME=:ARELATION');
Prepare;
ParamValues['AUSER']:='UserName'; {name of user}
ParamValues['PERMISSION']:='U'; {check UPDATE permission}
ParamValues['ARELATION']:='TableName'; {name of TABLE,VIEW or PROCEDURE}
Open;
if IsEmpty then ShowMessage('No permission for UPDATE!')
else ShowMessage('Persimission for UPDATE already OK!');
close;
end;

But, as Serg say - check error #335544352 in OnError event handler - it`s
simple way...

WBR, Dmitry Beloshistov AKA [-=BDS=-]
e-mail: torin@...

----- Original Message -----
From: "Митрюшкин С. А." <com@...>
To: <IBObjects@yahoogroups.com>
Sent: Thursday, November 22, 2001 10:24 AM
Subject: RE: [IBO] Handling user permissions


> > This is on my list of things to do but it doesn't have high
> > priority because
> > most people are writing their own using ROLEs. This is how I do it.
>
> as far as i remember, this question is asked every 2-3 months for a year
or
> two, and no universal solution exists :(
> what can i suppose - catch exeption #335544352 (not sufficient rights
while
> preparing edit-, deletesql), clear this xxxsql and reopen query. 10 lines
of
> code attached to onerror of main connection solve the problem forever :)
> ==
> Serg