Gossamer Forum
Home : Products : DBMan : Installation :

Allow Default user to Search & Add

Quote Reply
Allow Default user to Search & Add
 
How can you set it up so that there is authentication, but a default user can not only search, but add to the database as well?

here are my current cfg settings:
$auth_no_authentication = 0;
$auth_allow_default = 1;
@auth_default_permissions = (1,1,0,0,0);

The problem with this is that the admin or anybody that logs in cannot modify, delete or administer.

If i change default permissions to:
@auth_default_permissions = (1,1,1,1,1);
it defeats the purpose.

-danno
Quote Reply
Re: Allow Default user to Search & Add In reply to
Could you give us a link to your database? Also, if you make a copy of your entire .cfg file available, it will help.


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





Quote Reply
Re: Allow Default user to Search & Add In reply to
Site URL:
http://www.carcorral.com/new (just use the "for sale" links. The others are not functional yet.
Database Url: http://www.carcorral.com/dbused/cars.db
cfg file is as follows:
# URL of the directory dbman resides in. No Trailing Slash Please.
$db_dir_url = "http://www.carcorral.com/dbused";
# URL of dbman.
$db_script_url = $db_dir_url . "/index.cgi";
# Full Path and File name of the database file.
$db_file_name = $db_script_path . "/cars.db";
# Full path and file name of the counter file.
$db_id_file_name = $db_script_path . "/dw.count";
# Full path and file name of the authorization directory.
$auth_dir = $db_script_path . "/auth";
# Full path and file name of the password file.
$auth_pw_file = $db_script_path . "/dw.pass";
# Full path and file name of the log file.
$auth_log_file = $db_script_path . "/dw.log";
# Full path and file name of the html routines.
require $db_script_path . "/html.pl";


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

%db_def = (
ID => [0, 'numer', 5, 8, 1, '', ''],
date => [1, 'numer', 6, 10, 0, '', ''],
Category => [2, 'numer', 12, 12, 1, '', ''],
Make => [3, 'alpha', '25', 50, 1, '', ''],
Model => [4, 'alpha', '25', 50, 1, '', ''],
Year => [5, 'numer', 4, 4, 1, '', ''],
Description => [6, 'alpha', '800', 800, 0, '', ''],
Price => [7, 'alpha', '50', 50, 1, '', ''],
Name => [8, 'alpha', 50, 50, 0, '', ''],
Address => [9, 'alpha', 80, 80, 1, '', ''],
City => [10, 'alpha', 80, 80, 1, '', ''],
State => [11, 'alpha', 80, 80, 0, '', ''],
ZipCode => [12, 'numer', 10, 10, 0, '', ''],
Phone => [13, 'numer', 17, 17, 0, '', ''],
Phone2 => [14, 'numer', 17, 17, 0, '', ''],
Fax => [15, 'numer', 17, 17, 0, '', ''],
email => [16, 'alpha', 50, 50, 0, '', ''],
web => [17, 'alpha', 50, 50, 0, '', ''],
graphic => [18, 'alpha', 25, 25, 0, '', '']
);

# The column name for the database key. MUST be the first column in the database.
$db_key = 'ID';
# Value to insert for a NULL entry. Must not appear by itself normally.
$db_null = 'NULL';
# Database delimeter.
$db_delim = '|';
# Use file locking (1 = Yes, 0 = No). Should be used, but won't work on Win95/NT.
$db_use_flock = 1;
# Auto generate the html forms (1 = Yes, 0 = No).
$db_auto_generate = 0;
# Display Benchmarking Information (1 = Yes, 0 = No).
# use Benchmark; # Uncomment this line if benchmarking is used.
$db_benchmark = 0;
# Display Debugging Information (1 = Yes, 0 = No).
$db_debug = 0;

# Select fields. Field name => 'comma seperated list of drop down options'.
%db_select_fields = ( 'Category' => 'Cars,Trucks,Motorcycles,Boats,Parts',
'State' => 'Alabama,Alaska,Arizona,Arkansas,California,Colorado,Connecticut,Delaware,District Of Columbia,Florida,Georgia,Hawaii,Idaho,Illinois,Indiana,Iowa,Kansas,Kentucky,Louisiana,Maine,Maryland,Massachusetts,Michigan,Minnesota,Missis sippi,Missouri,Montana,Nebraska,Nevada,New Hampshire,New Jersey,New Mexico,New York,North Carolina,North Dakota,Ohio,Oklahoma,Ontario,Oregon,Pennsylvania,Puerto Rico,Rhode Island,South Carolina,South Dakota,Tennessee,Texas,Utah,Vermont,Virginia,Washington,West Virginia,Wisconsin,Wyoming,-----------,
Asia Pacific,
Canada,
Europe - Austria,
Europe - Belgium,
Europe - Bulgaria,
Europe - Croatia,
Europe - Cyprus,
Europe - Czech Republic,
Europe - Denmark,
Europe - Estonia,
Europe - Finland,
Europe - France,
Europe - Germany,
Europe - Greece,
Europe - Hungary,
Europe - Ireland,
Europe - Italy,
Europe - Latvia,
Europe - Lithuania,
Europe - Malta,
Europe - Netherlands,
Europe - Norway,
Europe - Poland,
Europe - Portugal,
Europe - Romania,
Europe - Russia,
Europe - Serbia,
Europe - Slovakia,
Europe - Slovenia,
Europe - Spain,
Europe - Sweden,
Europe - Switzerland,
Europe - Turkey,
Europe - Ukraine,
Europe - United Kingdom,
Latin America/Caribbean,
MidEast/Affrica - Bahrain,
MidEast/Affrica - Ghana,
MidEast/Affrica - Israel,
MidEast/Affrica - Ivory Coast,
MidEast/Affrica - Kenya,
MidEast/Affrica - Kuwait,
MidEast/Affrica - Lebanon,
MidEast/Affrica - Morocco,
MidEast/Affrica - Nigeria,
MidEast/Affrica - Qatar,
MidEast/Affrica - Reunion,
MidEast/Affrica - Saudi Arabia,
MidEast/Affrica - South Africa,
MidEast/Affrica - United Arab Emirates,
MidEast/Affrica - Zimbabwe');

# Radio fields. Field name => comma seperated list of radio buttons.
# %db_radio_fields = ( Validated => 'Yes,No' );

# Checkbox fields. Field name => Checkbox value.
# %db_checkbox_fields = ( Popular => 'Yes' );

# Default maximum number of hits returned in a search.
$db_max_hits = 10;
# Bold search results (1 = Yes, 0 = No).
$db_bold = 1;
# Regular and title fonts used in auto_generatrion and html.pl.
$font = 'font face="verdana,arial,helvetica" size="2"';
$font_title = 'font face="verdana,arial,helvetica" size="4"';

# 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 = 1;

# 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 = 0;

# 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,1,1,1,1);

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

# 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 = -1;

# 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.carcorral.com";

# ===========================================================================
# Build up some variables from your definitions. Internal use only.
foreach (sort { $db_def{$a}[0] <=> $db_def{$b}[0] } keys %db_def) {
push (@db_cols, $_);
$db_sort{$_} = $db_def{$_}[1];
$db_form_len{$_} = $db_def{$_}[2];
$db_lengths{$_} = $db_def{$_}[3];
$db_not_null{$_} = $db_def{$_}[4];
$db_defaults{$_} = $db_def{$_}[5];
$db_valid_types{$_} = $db_def{$_}[6];
}
1;
Quote Reply
Re: Allow Default user to Search & Add In reply to
At first glance, I see a problem with your .cfg file. You have

$auth_modify_own = 1;

and

$auth_user_field = -1;

In order to allow users to modify only their own records, you must have a field that contains the user id.

I just remembered that you said you wanted a default user to be able to add. Is there a reason you have $auth_signup set to 1?

You seem to have an old version of DBMan. You might want to download the newer version.

That would account for no one being able to modify or delete records.

I tried to check the permissions on your site, but it seems you've added a line to your sub html_admin_display --

<input type=hidden name="view_records" value=1>

You need to take that line out or your admin display won't work.

I'm not sure why "admin" wouldn't have admin permissions. Once you get these other things sorted out, I'll take another look.


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



[This message has been edited by JPDeni (edited April 05, 1999).]