Here's a few ideas taken from previous threads.
Hiding complete records:
I need to completely hide some records to be viewed from users, but to be seen from admins.
I placed a field like this:
FYEO => [18, 'alpha', -2, 2, 0, 'No', '']
this field is a radio box that when selected at "No" a user can see the record,
if setup as "Si" user cannot see the record.
well, I've tried to use hidden fields but when someone searches the database all records are displayed.
-------------------------------
Response:
I don't think that will work.
At that point in sub html_view_success, the value of the field for a particular record is not yet known.
The only way I can see this working is to add lines in sub query. At the beginning of sub query in the db.cgi file,
after: local (%sortby);
add code:
unless ($per_admin) {
$in{'FYEO'} = 'Si';
}
That will prevent the records that are not supposed to be seen from even being returned by the search.
------------------
JPD
---------------------------------
Show fields to record owner only:
How can I setup the script, to show one or two fields in the 'html_record_long' only to the owner of the record?
Answer:
First, close off the previous print qq| statement with a |;
Then add code:
if ($rec{'Userid'} eq $db_userid) {
print qq| [print out your fields you want displayed] |;
}
--------------------
Want only the owner of the record and those with admin permissions to see a field(s):
|;
if (($db_userid eq $rec{'UserID'}) || ($per_admin)) {
print qq| [The record information] |;
}
print qq|
Hope this provides you with ideas on how to accomplish your task.
Unoffical DBMan FAQ
http://redundantcartridge.com/dbman/