Subject | Re: [firebird-support] How non-SYSDBA user can see connections by other users? |
---|---|
Author | Ivan_P=c5=99enosil |
Post date | 2016-10-20T18:45:56Z |
> SYSDBA users can see other connected users using monitoring tablesYes, you can use database level on connect/on disconnect triggers. E.g.
> but is it possible to implement such feature for non-SYSDBA users? Are
> there event/triggers that act uppon connecting and disconnecting and
> which can insert usual database records. Triggers no MON$ tables are
> not suitable because MON$ tables are populated only during query time.
CREATE TABLE CONNECTED_USERS (
ID INTEGER,
USERNAME VARCHAR(32));
GRANT SELECT ON CONNECTED_USERS TO PUBLIC;
SET TERM ^;
CREATE TRIGGER TR_ON_CONNECT ON CONNECT AS
BEGIN
INSERT INTO CONNECTED_USERS(ID, USERNAME) VALUES (CURRENT_CONNECTION,
CURRENT_USER);
END^
CREATE TRIGGER TR_ON_DISCONNECT ON DISCONNECT AS
BEGIN
DELETE FROM CONNECTED_USERS WHERE ID=CURRENT_CONNECTION;
END^
SET TERM ;^
I.