Gossamer Forum
Home : Products : DBMan : Customization :

Authorization problems

(Page 2 of 2)
> >
Quote Reply
Re: Authorization problems In reply to
Yes, but moderators and people with normal modify permissions still can't rate or modify...

Quote Reply
Re: Authorization problems In reply to
There must be some combination of "if"s, "and"s, "or"s and "unless"es that will do this. Maybe if I write out what you need to do, I'll get some inspiration.

Code:
If this is an admin
he can modify it
If this is a moderator
If the record belongs to his group
he can modify it
If the record belongs to him
he can modify it
Right? Now we have to turn it around, because the script works the other way -- saying that if he doesn't meet the criteria he can't modify it.

Maybe we can turn the script around instead of the code.

Code:

$okay = 0;
if ($per_admin) { $okay=1; }
elsif ($per_mdr) {
if ($per_mdr == &group_number($data[$group_field])) {
$okay = 1;
}
}
if ($db_userid eq $data[$auth_user_field]) {
$okay = 1;
}
unless ($okay) {
$output .= "$line\n" and next LINE;
}
There's also going to be a problem with setting the userid field in the lines

Code:

if ($auth_user_field >= 0 and (!$per_admin or !$in{$db_cols[$auth_user_field]})) {
$in{$db_cols[$auth_user_field]} = $data[$auth_user_field];
}
But if we get the other thing worked out first, we can get this fixed later. I hope. Smile

JPD
Quote Reply
Re: Authorization problems In reply to
OK, that works... I have no idea what problem that other line would cause... Everything seems to be working perfectly! Thanks a ton! Smile

jorge

Quote Reply
Re: Authorization problems In reply to
The problem is that, when a moderator edits someone else's record, the moderator's userid will be entered into the userid field of the record.

You could just delete the line, although it would take away some of the security of the database.

I'm glad I was able to *finally* figure it out. It just takes some "thinking out loud" sometimes.


JPD
Quote Reply
Re: Authorization problems In reply to
Actually, that didn't happen...

Maybe it's because of my little modifications...

Sub html_rating_form_record calls html_rank_record, instead of html_record_form. And html_rank_record displays all the information, but only shows an <input> box for the Rating field. However, to avoid getting a "such and such field cannot be blank" error, I carried ALL the fields as <input type="hidden"> fields. So all the information from the record is carried on in the hidden fields, even the UID.

Well, everything's working fine.

Thanks for everything!

jorge

> >