Subject | Password-Lock a row in a table |
---|---|
Author | yuraukar |
Post date | 2005-01-24T11:12:57Z |
I am trying to password-lock a row in a table. The purpose is as follows:
A user should be able to lock an individual row in a table from
modification (no, this has nothing to do with concurrency).
Any attempt to modify data in that row should then be rejected.
The easy solution is to have a column that stores the password (could
be encrypted, but for testing it's clear text). If the column is NULL,
any changes are accepted, otherwise they are rejected through a trigger
CREATE TRIGGER protect_my_table FOR my_table
ACTIVE BEFORE UPDATE POSITION 1
AS
BEGIN
IF (OLD.passwd IS NOT NULL) THEN BEGIN
EXCEPT protection_exception;
END
END
This however also locks the user from removing the password to unlock
the row later on. I was thinking about a stored procedure that - given
the password and row ID - would remove the password, but came to no
working AND secure solution.
Any help or ideas from the group?
Yuraukar.
BTW: Thanks for the very very good support from the FB team here! You
have saved my from numerous troubles and increased my understanding of
databases in general and firebird very much.
A user should be able to lock an individual row in a table from
modification (no, this has nothing to do with concurrency).
Any attempt to modify data in that row should then be rejected.
The easy solution is to have a column that stores the password (could
be encrypted, but for testing it's clear text). If the column is NULL,
any changes are accepted, otherwise they are rejected through a trigger
CREATE TRIGGER protect_my_table FOR my_table
ACTIVE BEFORE UPDATE POSITION 1
AS
BEGIN
IF (OLD.passwd IS NOT NULL) THEN BEGIN
EXCEPT protection_exception;
END
END
This however also locks the user from removing the password to unlock
the row later on. I was thinking about a stored procedure that - given
the password and row ID - would remove the password, but came to no
working AND secure solution.
Any help or ideas from the group?
Yuraukar.
BTW: Thanks for the very very good support from the FB team here! You
have saved my from numerous troubles and increased my understanding of
databases in general and firebird very much.