Gossamer Forum
Home : Products : DBMan : Customization :

User's record limit?

Quote Reply
User's record limit?
I would like to set up the database so that a user is limited to a specified number of records. They would then have Add, Modify, Delete rights but could only add records up to their limit.

One way of getting around this is to set up new users with the specified number of blank records, then only give them Modify priveledges. I Can't seem to configure the .cfg to just give someone Modify priveledges only, they always seem to come up with Add, Delete, Modify.

A brute force workaround I've found for this is to edit the html.pl file and take out the Add, Modify, Delete links from the footer subroutine.

Any smarter ideas on how to do this would be appreciated.

Thanks
Quote Reply
Re: User's record limit? In reply to
You should be able to give Modify privileges only. Set

@auth_signup_permissions = (1,0,1,0,0);

Your workaround will work -- setting up blank records for each user -- but, if every user can have the same number of records, there's a little easier way to do it. If you are going to set up different numbers of records depending on what type of user they are, I'm working on trying to create a mod for that.


------------------
JPD





Quote Reply
Re: User's record limit? In reply to
Yes, I would like every user to have the same maximum number of records...

Thanks
Phil
Quote Reply
Re: User's record limit? In reply to
That's much easier.

For my illustration, I'm going to say there are 5 records allowed per user. You should be able to change it if you need to.

In db.cgi, sub validate record, change

Code:
if ($data[$db_key_pos] eq $in{$db_key}) {
return "duplicate key error";
}
}
close DB;

to

Code:
if ($data[$db_key_pos] eq $in{$db_key}) {
return "duplicate key error";
}
if ($data[$auth_user_field] eq $db_userid) {
++$user_count;
}
}
close DB;
if ($user_count >= 5) {
return "maximum number of records reached"
}



------------------
JPD







[This message has been edited by JPDeni (edited October 06, 1999).]
Quote Reply
Re: User's record limit? In reply to
Thanks, I'll try it out tonight!