Give Admin-Access to Certain Scripts for a Specified Group - Page 2 Give Admin-Access to Certain Scripts for a Specified Group - Page 2
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Give Admin-Access to Certain Scripts for a Specified Group

Started by AvrilBoi, June 20, 2006, 04:39:58 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Paver

You're right - I was wrong about that statement.  I thought at first you were merely making a backup of the original scripts.  Instead you modified only certain scripts to use the admin access.

My second statement is the correct one.  All admin functions of those 3 scripts you modified (that access include/init_mod.inc.php) will be available to those in the group.  All other scripts will only be available to true administrators.

AvrilBoi

Ok, fantastic!
Can I open a new thread here and wait it is moved to the Modifications board?

Paver

It's best to keep the entire discussion with a mod.  That way, people will understand the motivation for the mod and how it was implemented.

Your mod-guide is useful and I put a link to it (well, the post above it) to the first post.

I modified the subject as well to make it clear on the board index what this mod does.

Joachim Müller

As suggested above: this thread is a mess, it shouldn't be in the sub-board "Modifications/Add-Ons/Hacks". Potential readers won't understand what happened, with all the editing this thread suffered from. I suggested starting a new thread, summarizing the actual mod and linking this thread. Then move this thread out of the mods board and the new thread into it.

Paver

@GauGau: Ok.  Your suggestion makes sense.  I'll keep this in mind for future mod threads.

cain.

Hi,
great mod, thank you.

I have a question: how to enable these rights in xp_publish.php as well?

replacing

require('include/init.inc.php');

with

require('include/init_mod.inc.php');

and every

USER_IS_ADMIN

with

(USER_IS_ADMIN||USER_IS_ADMIN_MANUAL)

has no visible effect.

I even tried to just replace every USER_IS_ADMIN with 1. It was possible to upload pictures to any public album for a user, then. At least that was what the XP_Publishing wizard said, the images did not appear in the designated albums  ???

Joachim Müller

As suggested above, this thread is already messed up. Don't ask for new features in it.

IIIBradIII

Just as a heads-up, if the usergroup you intend to give admin rights to is assigned a 2-digit number, you'll need to change the following:

$mod_usergroups = explode(',',substr(USER_GROUP_SET,1,-1));

to this:

$mod_usergroups = explode(',',substr(USER_GROUP_SET,2,-1));

WC

Quote1) make a group
2) put in the group the users you want to allow to manage albums
3) go in the database, than go in the table _usergroup, and than check in group_id the number referring to the new group you've made
4) make a copy of albmgr.php, delete.php and include/init.inc.php and coll'em for example albmgr_mod.php etc.
5) open albmgr_mod.php
find
require('include/init.inc.php');
replace with
require('include/init_mod.inc.php');
find
action="delete.php?what=albmgr"
replace with
action="delete_mod.php?what=albmgr"
6) open delete_mod.php
find
require('include/init.inc.php');
replace with
require('include/init_mod.inc.php');
7) open init_mod.inc.php
find
$USER['am'] = isset($USER['am']) ? (int)$USER['am'] : 0;
after, add
// MOD - add manual admin access
$mod_usergroups = explode(',',substr(USER_GROUP_SET,1,-1));
$mod_allowedgroups = array('NUMBER CHECKED BEFORE');
$mod_validuser = (array_intersect($mod_allowedgroups,$mod_usergroups) ? true : false);
define('USER_IS_ADMIN_MANUAL', $mod_validuser);
define('GALLERY_ADMIN_MODE', (USER_IS_ADMIN || USER_IS_ADMIN_MANUAL) && $USER['am']);
// MOD - end
upload all new files
9) give the users who belong to the group 5 the link to albmgr_mod.php

I'm having a little trouble getting the mod to work. I created a group called "junior admins" and assigned a test user to it. I then went to phpbb_usergroup in my database. However, for some reason the group id number is "1761" (which seems rather high as I haven't created that many groups). Anyway, after following each of these the steps in the instructions set out above and then logging in as that user in that group, I went to albmgr_mod.php. However, it does not seem to show me as being in admin mode there. I still seem to be an ordinary user and can still only modify my own albums but not the public galleries as a whole.  I would like certain users to be able to create public albums or to modify the properties (eg on modifyalb.php) in order for them to set whether visitors are allowed to upload files etc. 

How do I get this group to have admin rights to the gallery without making them full administrators of the entire site? Am I doing something wrong with the mod?

Quote from: IIIBradIII on March 27, 2007, 06:08:56 AM
Just as a heads-up, if the usergroup you intend to give admin rights to is assigned a 2-digit number, you'll need to change the following:

$mod_usergroups = explode(',',substr(USER_GROUP_SET,1,-1));

to this:

$mod_usergroups = explode(',',substr(USER_GROUP_SET,2,-1));

The group id I checked was a 4 digit number (1761). Would that have to be a "4" in the code above where the 2 is?

Any help would be appreciated.

Thanks


Joachim Müller

Not sure if this "mod" has been designed with bridging in mind, so I doubt that you will be able to make it work on your setup.

Quote from: WC on June 11, 2007, 10:51:23 PM
The group id I checked was a 4 digit number (1761). Would that have to be a "4" in the code above where the 2 is?
I guess so.

Riccardo83

Would this code work for vBulletin too?

Quote from: Paver on June 21, 2006, 08:46:26 PM

I still recommend adding in *only* the features you want to group 5, and not making them full admins, but here's the simple mod you want.  In include/init.inc.php, add the lines bracketted by // MOD and // MOD - end into the lines you already specified, as shown:
// Test if admin mode
$USER['am'] = isset($USER['am']) ? (int)$USER['am'] : 0;
// MOD - add manual admin access
$mod_usergroups = explode(',',substr(USER_GROUP_SET,1,-1));
$mod_allowedgroups = array('5');
$mod_validuser = (array_intersect($mod_allowedgroups,$mod_usergroups) ? true : false);
define('USER_IS_ADMIN_MANUAL', $mod_validuser);
define('GALLERY_ADMIN_MODE', (USER_IS_ADMIN || USER_IS_ADMIN_MANUAL) && $USER['am']);
// MOD - end
define('GALLERY_ADMIN_MODE', USER_IS_ADMIN && $USER['am']);
define('USER_ADMIN_MODE', USER_ID && USER_CAN_CREATE_ALBUMS && $USER['am'] && !GALLERY_ADMIN_MODE);


Joachim Müller

Quote from: Riccardo83 on October 04, 2008, 05:01:19 PM
Would this code work for vBulletin too?
Did you bother to read the post just one above yours:
Quote from: Joachim Müller on June 12, 2007, 09:11:31 AM
Not sure if this "mod" has been designed with bridging in mind, so I doubt that you will be able to make it work on your setup.
From your other open thread on the same issue:
Quote from: Joachim Müller on October 05, 2008, 12:08:54 PM
We can't tell, since none of the devs is using vb.