I've gone through the documentation and one thing is not clear to me. If the administrator of a database needs to be able to add, change, and delete records, but all other users should only be able to view records, is this possible? I realize that the
$opts['options']
parameter allows the setting of permissions, but are they not global? If I set them to read-only permissions like
$opts['options'] = 'VFL'
then isn't the administrator limited by these permissions also? I've searched the forums and seen questions about multiple users, but I don't understand the answers. Please advise.
|
What about this idea: If I make a copy of the php file that phpMyEdit creates and give it a different filename, and I change the
$opts['options']
permissions to read-only in this file, then let other users only use this file, while the admin can use the first file which has all permissions not merely read-only ones? In other words, if users go to file1.php and have only read-only privileges, and the admin uses file2.php which has no limitations, would that work? They are accessing the same database and table. I could have both files in the same .htaccess-protected directory and the directory would have an index file so that no one can access both files. Does this make sense?
|
I also have this code snipet for you guys. I put all of the configuration stuff at the top of the page so that non-tech geek people at my company can make better sense. I define a list of fields that I would like to display in $fieldList. Then I extract the fields from $fieldList and run them through the defineField funtion. This adds them to the page in the order specified. After that I use the permissions code from the previous post. Essentially I just seperated the field definitions from the permissions. I defined the 'options' for the primary key and the first field that I would always like to display and as read only. After that the individual experience begins.
$fieldList = "priKey,item"; //Fields are listed on webpage in this order
/************************************************************/
/*************Field Definitions******************************/
/************* *****************************/
function defineField(&$opts, $inField) {
switch($inField) {
############################################
case 'priKey' : //** This field is generally ignored
$opts['fdd'][$inField] = array(
'name' => 'PriKey',
'select' => 'T',
'options' => 'HR',
'maxlen' => 11,
'default' => '0'
);
break;
############################################
case 'item' :
$opts['fdd'][$inField] = array(
'name' => 'Item',
'options' => 'LVCR',
'select' => 'T',
'maxlen' => 20,
'size|F' => 16,
'sort' => true,
'URLprefix' => 'files/',
'URL' => '$value',
'URLpostfix' => '.pdf'
);
break;
############################################
case 'site' :
$opts['fdd'][$inField] = array(
'name' => 'Site',
'select' => 'D',
'maxlen' => 45,
'size|F' => 7,
'sort' => true,
'values' => array()
);
break;
|