OK, as I see, there are no possibility to assign some exclisive privileges to some specific user without gambling with groups, and no possibility to enable all privileges but config to some users (moderators). I asked a question but got no way to solve problem, so I made a patch for Coppermine. May be, this patch will be useful for somebody...
This patch (or mod) adds possibility to assign to specific users all privileges from
Groups menu +
Admin (user = admin) +
Moderator (user = admin - config
.
I cannot post files to this forum, so I will try to describe process here
First, you have to download file
http://king2.kaluga.ru/exclude.zip, place it to gallery root path and unzip. There two files in zip -
excludemgr.php and
excludecheck.php.
Next, you have to edit
groupmgr.php file. Find code at the end of file:
endtable();
pagefooter();
ob_end_flush();
and change it to the:
endtable();
include("excludemgr.php");
pagefooter();
ob_end_flush();
OK, now we have to edit
include/init.inc.php. Look for
error_reporting(E_ALL);
and add a line, you'll get:
error_reporting(E_ALL);
include("excludecheck.php");
Now find
define('USER_GROUP', $USER_DATA['group_name']);
define('USER_GROUP_SET', '(' . $USER_DATA['group_id'] . ')');
define('USER_IS_ADMIN', USER_ID ? ($USER_DATA['mgroup'] == IB_ADMIN_GROUP) : 0);
define('USER_CAN_SEND_ECARDS', (int)$USER_DATA['can_send_ecards']);
define('USER_CAN_RATE_PICTURES', (int)$USER_DATA['can_rate_pictures']);
define('USER_CAN_POST_COMMENTS', (int)$USER_DATA['can_post_comments']);
define('USER_CAN_UPLOAD_PICTURES', (int)$USER_DATA['can_upload_pictures']);
define('USER_CAN_CREATE_ALBUMS', USER_ID ? (int)$USER_DATA['can_create_albums'] : 0);
mysql_free_result($result);
and add two lines:
define('USER_GROUP', $USER_DATA['group_name']);
define('USER_GROUP_SET', '(' . $USER_DATA['group_id'] . ')');
if (!special_user()) {
define('USER_IS_ADMIN', USER_ID ? ($USER_DATA['mgroup'] == IB_ADMIN_GROUP) : 0);
define('USER_CAN_SEND_ECARDS', (int)$USER_DATA['can_send_ecards']);
define('USER_CAN_RATE_PICTURES', (int)$USER_DATA['can_rate_pictures']);
define('USER_CAN_POST_COMMENTS', (int)$USER_DATA['can_post_comments']);
define('USER_CAN_UPLOAD_PICTURES', (int)$USER_DATA['can_upload_pictures']);
define('USER_CAN_CREATE_ALBUMS', USER_ID ? (int)$USER_DATA['can_create_albums'] : 0);
}
mysql_free_result($result);
It is very important to add first line (
special_user) before
USER_IS_ADMIN line and second line (
}) just before
mysql_free_result($result);.
A 10-15 lines below you will find very similar piece of defines, change it same way. You'll get:
define('USER_ID', 0);
define('USER_NAME', 'Anonymous');
define('USER_GROUP_SET', '(' . IB_GUEST_GROUP . ')');
if (!special_user()) {
define('USER_IS_ADMIN', 0);
define('USER_CAN_SEND_ECARDS', (int)$USER_DATA['can_send_ecards']);
define('USER_CAN_RATE_PICTURES', (int)$USER_DATA['can_rate_pictures']);
define('USER_CAN_POST_COMMENTS', (int)$USER_DATA['can_post_comments']);
define('USER_CAN_UPLOAD_PICTURES', (int)$USER_DATA['can_upload_pictures']);
define('USER_CAN_CREATE_ALBUMS', 0);
}
mysql_free_result($result);
If you are using bulletin integration, you have to patch same way
bridge/YOURBOARDNAME.inc.php (another two places).
Continue with
include/init.inc.php. Find
require "themes/{$CONFIG['theme']}/theme.php";
$THEME_DIR = "themes/{$CONFIG['theme']}/";
and add a line:
require "themes/{$CONFIG['theme']}/theme.php";
if (DISABLE_CONFIG) template_extract_block($template_gallery_admin_menu, 'config');
$THEME_DIR = "themes/{$CONFIG['theme']}/";
Now we have to patch themes. Open each
themes/THEMENAME/theme.php file and find lines:
<td class="admin_menu"><a href="editpics.php?mode=upload_approval" title="">{UPL_APP_LNK}</a></td>
<td class="admin_menu"><a href="config.php" title="">{CONFIG_LNK}</a></td>
<td class="admin_menu"><a href="albmgr.php{CATL}" title="">{ALBUMS_LNK}</a></td>
add two lines:
<td class="admin_menu"><a href="editpics.php?mode=upload_approval" title="">{UPL_APP_LNK}</a></td>
<!-- BEGIN config -->
<td class="admin_menu"><a href="config.php" title="">{CONFIG_LNK}</a></td>
<!-- END config -->
<td class="admin_menu"><a href="albmgr.php{CATL}" title="">{ALBUMS_LNK}</a></td>
OK, we got a part of theme marked as 'config'. This part of HTML (actually, config tab) will be removed if user has
Moderator flag set.
OK, now you have to browse
http://youserver.yourdomain/gallerypath/groupmgr.php?create_table=1. Your SQL user must have rights to create tables. OK, patching is finished.
Click to
Groups. You will see second edit form (below groups editor) with one empty record. You can enter some username here and change its privileges. Press
Apply changes (after second table). Now you will see two records - one you just entered and second empty. To delete user just make its username empty and
Apply changes. Settings in second table will override settings from user's group.
Second table has two new fields -
Admin and
Moderator. If you set
Admin to
Yes, user will have admin rights. If you set
Moderator to
Yes, user wil have admin rights, but he will have no access to
Config menu.
So, that's all. Use it if you need it.
Is it useful?