Gossamer Forum
Home : Products : DBMan : Customization :

2 auth signup permissions ?

Quote Reply
2 auth signup permissions ?
Is it possible to make a two auth_signup_permissions ? , working with a relational database.

1. Registered Users are only allowed to add a single record (user.db) , which is their Account record.

2. Registered Users are limited to add records in another databases examples posting jobs (jobs.db). They are limited to a max. 5 records and will be autodelete in 60 days.

How to get these working on a relational database ?

Any help would be very appreciated.

Quote Reply
Re: 2 auth signup permissions ? In reply to
All you need to do is to set the $db_key to the userid field in the user db. They will only be able to add one record each.

JPD
http://www.jpdeni.com/dbman/
Quote Reply
Re: 2 auth signup permissions ? In reply to
Thanks JPD !.

Yes, I've already use it the $db_key to the Userid, but there is 2 cfg files with 2 @auth_signup_permissions.

user.cfg :
@auth_signup_permissions = (1,1,1,1,0,0);

item.cfg :
@auth_signup_permissions = (1,5,1,1,0,0);

The results are when user sign up, the db.cgi works only with the user.cfg ( because the password and permissions are printed to the user.cfg ).

At the moment, I just figure it out with adding to :

user.cfg :
@auth_signup_permissions = (1,2,1,1,0,0);

Well, this is temporary I think.

I don't get it with your ideas about setting up the $db_key ?



Quote Reply
Re: 2 auth signup permissions ? In reply to
Set up the signup permissions to be the same in both databases

user.cfg :
@auth_signup_permissions = (1,5,1,1,0,0);

item.cfg :
@auth_signup_permissions = (1,5,1,1,0,0);

In both of your files, you have an auth_user_field, right? For the user database, set the $db_key variable to the same name as the auth_user_field. The user will only be able to add one record.

For example, if your auth_user_field is named UserID, set

$db_key = 'UserID';

JPD
http://www.jpdeni.com/dbman/
Quote Reply
Re: 2 auth signup permissions ? In reply to
Sorry JPD for this late response, there was trouble in my
telephone line.

OK , I've tried setting up the $db_key variable to the same

name as the auth_user_field :

$db_key = 'Userid';
$auth_user_field = 0;

Both User and Item.cfg are configured with the same position

as the "$db_key" name, and also setup the same :

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

The result are :

User now can create a 5 account ( not 1 ) either it was

create on the user.db or item.db.

For info I've used a limiting add code in the db.cgi

Any other ideas ?

- Tommy -

Quote Reply
Re: 2 auth signup permissions ? In reply to
In Reply To:
Both User and Item.cfg are configured with the same position

as the "$db_key" name
No. The Item.cfg should have a counter field as the $db_key field.

You will need to do a little editing of the mod, though.

In sub add_record,

Code:

unless ($per_admin or ($db_setup eq 'user')) {
open (PASS, "<$auth_pw_file") or &cgierr ("unable to open: $auth_pw_file.\nReason: $!");
if ($db_use_flock) { flock(PASS, 1); }
@lines = <PASS>;
close PASS;
I don't see how a user can create multiple records on the user database if you have the db_key set to the auth_user_field. The script will not allow multiple records with the same key.

Did you set $db_key_track=0; in your user.cfg file? You do need to do that.

JPD
http://www.jpdeni.com/dbman/
Quote Reply
Re: 2 auth signup permissions ? In reply to
Yes JPD, you're right !

I forgot to turn off the $db_key_track=0

Ok , could you hold on while I'm making some changes

according to your instructions ?

Thanks JPD

- Tommy -

Quote Reply
Re: 2 auth signup permissions ? In reply to
I guess I ought to have mentioned that before. Sorry 'bout that.

With any luck, I'm going to get some sleep. But I'll be back later today.

JPD
http://www.jpdeni.com/dbman/
Quote Reply
Re: 2 auth signup permissions ? In reply to
Thanks JPD.

I guess that you have a longer sleeping time ! Well, I have no luck, it's still restricted the item.db adding records.

The changes are only made in the user.db, that is limiting the add records for only 1 records.

And in the item.db it's just lockup the adding record. I mean the links doesn't show the "add" text links (sub html_footer)

Is it because the add_permission code in the item.db ?

print qq!<$font_color>|</font> <A HREF="$db_script_link_url&add_form=1"><$font>Add</A></font> ! if ($per_add);

or I must change something in the db.cgi script ?

Thanks JPD.

Quote Reply
Re: 2 auth signup permissions ? In reply to
Check in your .pass file to see what the numbers are for the "add" permission. You probably should set the default add permission to be one more than the number of items a user can add. For example, if a user can add 5 items, set the value to 6 to account for the user record.

You may need to start over with a new .pass file.

JPD
http://www.jpdeni.com/dbman/