Gossamer Forum
Home : Products : DBMan : Customization :

reverse auth_own

Quote Reply
reverse auth_own
I was wondering if there was a way to set up the Auth_own only, to where if the uid was a special uid that no one but an admin could modify it. Or set it to a different field. I want to lock certain records from being modified except for Admin.
I have several people helping complete records but when they are complete I want to lock them.
Any ideas would be most welcome.

Quote Reply
Re: reverse auth_own In reply to
Well, you could change the uid to your own username after the record is completed so that only you could modify it.

JPD
http://www.jpdeni.com/dbman/
Quote Reply
Re: reverse auth_own In reply to
But I would have to toggle the Auth_own on which I don't have it on right now. That would work but no one would be able to modify anything but there own records, and that won't work. Can I change the actual Auth_own stuff to
if its uid="Me" they can't . But other wise they can no matter who's it is.

Quote Reply
Re: reverse auth_own In reply to
Then the only way I can think of is to create a new field -- Lock. Make it an admin-only field. Enter a 1 in the field when you want to lock a record.

Then, in sub modify_record, after

($output .= "$line\n" and next LINE) if ($restricted and ($db_userid ne $data[$auth_user_field]));

add

($output .= "$line\n" and next LINE) if (!$per_admin and $data[number of "Lock" field]);

You will also have to add a delimiter to every record that is currently in your database. Open the .db file in a text editor and add a | (or whatever your delimiter is) to the end of each line.

JPD
http://www.jpdeni.com/dbman/
Quote Reply
Re: reverse auth_own In reply to
I tired to post earlier but couldn't get it to post.
I figured it out..I use DBMANSQL and found that most of the stuff here works .. but what you posted would not work...
in the .cfg
I toggled the auth_own_mod to 1
then I created a new
$lock field = 'Locked'

Then went in to the cgi and found the Mod and Del subs
and found
# We add an extra check if the user is only allowed to
# modify his own records.
$userid_q = $DBH->quote($db_userid);
($auth_modify_own and !$per_admin) ?
($query = qq!
UPDATE $db_table SET $update
WHERE $db_key = $key_q AND
**THIS IS THE BIG CHANGE $lock_field = No
I got the idea from your Validate mod
I'm not sure if this would work on the DBman regular but thought I would throw it out there. It's not fancy if someone tries to change a record that is lock they get an error message saying record not found etc...