Gossamer Forum
Home : Products : DBMan : Installation :

Add / modify own record difficult

Quote Reply
Add / modify own record difficult
Hello! I have gone in circle the last couple of days so I am seeking assistance - The purpose of my database is that anyone (default user) can search w/out logging on; users cannot create own account - those with permission can add, modify and delete - and

Here is my trouble - the admin can do everything with no problem, default search is no problem - BUT those who need to logon after they have added a record their second and so on records are recorded into the database but they can only modify and delete a single record (their first one, I believe; also, strangely, when they do add their second record the confirmation screen shows up only a few field which are blank - the script can be found at:
http://www.sysadminsrus.com/cgi-local/dbman4/db.cgi
I created a new user with no records: user1 / use1 or you can logon in as company1/password1 which has several records already entered.

Here is my config permissions;
# No Authentication? (1 = "there is no authentication", 0 = "there is authentication")
# If you choose no authentication, then set the permissions of what
# people can do with: @auth_default_permissions below.
$auth_no_authentication = 0;

# The amount of time in seconds that user files are kept in the
# auth directory before the program removes them. 2-6 hours is
# probably a good value.
$auth_time = 21600; # 6 hours (in seconds)

# Enable (1) or disable (0) logging.
$auth_logging = 1;

# Allow a default user? This means you can specify a user via the URL
# and skip the logon process. Use this to allow people to search without
# logging on, but require log in if they want to add/modify/remove etc.
# (1 = "yes", 0 = "no")
$auth_allow_default = 1;

# Default permissions used if there is no authentication, or for a default
# user. (View, Add, Delete, Modify, Admin), 1 = enable, 0 = disable.
@auth_default_permissions = (1,0,0,0,0);

# Allow people to sign up for their own userid/passwords? They will
# recieve default permissions.
$auth_signup = 1;

# Permissions a new signup should get.
@auth_signup_permissions = (1,1,1,1,0);
# Registered users: can modify/delete _only_ own records. For this to make
# sense you should set default off or to 1,0,0,0.
$auth_modify_own = 1;

# Registered users: can view _only_ own records. For this to make sense
# you should turn off default permissions.
$auth_view_own = 0;

# Auth user field. This is the field position in the database used for storing
# the userid who owns the record. Set to -1 if not used.
$auth_user_field = 0;

# URL to send user if they chose log off. Leave blank and the script will return to
# the logon prompt (although this only makes sense if you are using authentication).
$auth_logoff = "http://www.sysadminsrus.com";

here is part of the Database definition:

# Database Definition
# --------------------------------------------------------
# Definition of your database. Format is
# field_name => ['position', 'field_type', 'form-length', 'maxlength', 'not_null', 'default', 'valid_expr']

%db_def = (
'number' => [ 0, 'numer', -1, 255, 0, '', ''],
'userID' => [ 1, 'alpha', -1, 255, 0, '', ''],
'Job ID' => [ 2, 'alpha', 20, 255, 1, '', ''],
'Technical Area' => [ 3, 'alpha', 0, 28, 1, '', ''],
'Job Title' => [ 4, 'alpha', 20, 255, 0, '', ''],
'City Location' => [ 5, 'alpha', 20, 255, 0, '', ''],
'State Location' => [ 6, 'alpha', 0, 20, 0, '', ''],
'Area Code' => [ 7, 'alpha', 20, 255, 0, '', ''],
'Term' => [ 8, 'alpha', 0, 16, 0, '', ''],
'Salary' => [ 9, 'alpha', 0, 14, 0, '', ''],
'Years Experience' => [10, 'alpha', 0, 29, 0, '', ''],
'Authorization' => [11, 'alpha', 0, 28, 0, '', ''],
'Job Requirements' => [12, 'alpha', '40x5', 1000, 1, '', ''],
'Company/Job Description'=> [13, 'alpha', '40x5', 1000, 0, '', ''],
'Email Apply' => [14, 'alpha', 20, 255, 0, '', '.+@.+..+'],
'Phone' => [15, 'alpha', 20, 255, 0, '', ''],
'Fax' => [16, 'alpha', 20, 255, 0, '', ''],
'Company Website' => [17, 'alpha', 20, 255, 0, 'http://', '^http://'],
'Date Posted' => [18, 'date', 20, 255, 0, &get_date(), '']
);


Thanks for looking at this,

Jim

Quote Reply
Re: Add / modify own record difficult In reply to
Jim.
Dbman dosn't like it when you try and use $auth_allow_default = 1; and $auth_modify_own = 1; together.
You either need to have one or the other.
This also applies to $auth_view_own and $auth_allow_default, although there is a mod which will allow you to do both if you need it.
Read the readme.txt file which comes with DBman, the permissions are explained in that.

hope this helps
Bob
Quote Reply
Re: Add / modify own record difficult In reply to
Thank you for your reply; I have methodically made a variet of permission changes and installed the Mod you suggested - I am still stuck - I do wonder if it has something to do with the UserID or Key (which I do not completely understand.

Anyway, I am to a point now where all seems to work EXCEPT - that a registered user (company1 /password1) when going to "list all" to delete or modify ALL records are shown and they can change ANY record - below is the permissions:

# Authorization Options
# --------------------------------------------------------
# No Authentication? (1 = "there is no authentication", 0 = "there is authentication")
# If you choose no authentication, then set the permissions of what
# people can do with: @auth_default_permissions below.
$auth_no_authentication = 0;

# The amount of time in seconds that user files are kept in the
# auth directory before the program removes them. 2-6 hours is
# probably a good value.
$auth_time = 21600; # 6 hours (in seconds)

# Enable (1) or disable (0) logging.
$auth_logging = 1;

# Allow a default user? This means you can specify a user via the URL
# and skip the logon process. Use this to allow people to search without
# logging on, but require log in if they want to add/modify/remove etc.
# (1 = "yes", 0 = "no")
$auth_allow_default = 1;

# Default permissions used if there is no authentication, or for a default
# user. (View, Add, Delete, Modify, Admin), 1 = enable, 0 = disable.
@auth_default_permissions = (1,0,0,0,0);

# Allow people to sign up for their own userid/passwords? They will
# recieve default permissions.
$auth_signup = 0;

# Permissions a new signup should get.
@auth_signup_permissions = (0,1,1,1,0);
# Registered users: can modify/delete _only_ own records. For this to make
# sense you should set default off or to 1,0,0,0.
$auth_modify_own = 0;

# Registered users: can view _only_ own records. For this to make sense
# you should turn off default permissions.
$auth_view_own = 0;

# Auth user field. This is the field position in the database used for storing
# the userid who owns the record. Set to -1 if not used.
$auth_user_field = 0;

# URL to send user if they chose log off. Leave blank and the script will return to
# the logon prompt (although this only makes sense if you are using authentication).
$auth_logoff = "http://www.sysadminsrus.com";
Quote Reply
Re: Add / modify own record difficult In reply to
Hi Jim:

I think that your problem is with your key. See what is happening is that you are entering multiple records with the same key. Let's say you added one record and then the same user added another record, they are both using the same key which is why when you tried to access the record it only displayed one of them. I can't be sure where exactly your problem lies in the script but if you could post your default.cfg up on the web to let me take a look, I have a good chance of finding out where your problem is.

Hope that helps
Sun
Quote Reply
Re: Add / modify own record difficult In reply to
I suspected as much - your help is appreciated; I have posted the default.cfg at:
http://www.sysadminsrus.com/default.cfg
and the html.pl (if you have a suggested change) at:
http://www.sysadminsrus.com/html.pl

Thanks,

Jim
Quote Reply
Re: Add / modify own record difficult In reply to
Jim,
I see what you have done here.
You don't have an ID field, and your $auth_user_field should be set to 1, as that is the field number of your UserID field.
Your first to fields should look like this -
Code:
ID => [0, 'numer', -1, 8, 1, '', ''],
Userid => [1, 'alpha', -1, 15, 0, '', ''],
Then set your $auth_user_field to 1, which is your UserID field.
Make sure these to field names are entered exactely as above as they are case dependent.
Also I don't think you need to enclose your field names with single quotes, so you can take them our.
If you need a number field, add it to the end.
Also forget the double permission mod. It dosn't realy apply in this case, and I should not have mentioned it.

hope this helps
Bob
Quote Reply
Re: Add / modify own record difficult In reply to
Hi Jim:

I think Bob is right. Please give it a try and if it still fails to work please post another message.

Cheers
Sun
Quote Reply
Re: Add / modify own record difficult In reply to
Hello - I think I got it! Thanks to Bob, Sun for your support!