Advanced search  

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]

Pages: 1 [2]   Go Down

Author Topic: Give Admin-Access to Certain Scripts for a Specified Group  (Read 42593 times)

0 Members and 1 Guest are viewing this topic.

Paver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1609
  • Paul V.

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.
Logged

AvrilBoi

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 61

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

Paver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1609
  • Paul V.
Re: Give Admin-Access to Certain Scripts for a Specified Group
« Reply #22 on: June 22, 2006, 03:04:57 pm »

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.
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Give Admin-Access to Certain Scripts for a Specified Group
« Reply #23 on: June 23, 2006, 07:54:37 am »

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.
Logged

Paver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1609
  • Paul V.
Re: Give Admin-Access to Certain Scripts for a Specified Group
« Reply #24 on: June 23, 2006, 01:42:59 pm »

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

cain.

  • Coppermine newbie
  • Offline Offline
  • Posts: 1
Re: Give Admin-Access to Certain Scripts for a Specified Group
« Reply #25 on: September 06, 2006, 01:21:51 am »

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  ???
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Give Admin-Access to Certain Scripts for a Specified Group
« Reply #26 on: September 06, 2006, 07:02:07 am »

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

IIIBradIII

  • Coppermine newbie
  • Offline Offline
  • Posts: 10
Re: Give Admin-Access to Certain Scripts for a Specified Group
« Reply #27 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:

Code: [Select]
$mod_usergroups = explode(',',substr(USER_GROUP_SET,1,-1));
to this:

Code: [Select]
$mod_usergroups = explode(',',substr(USER_GROUP_SET,2,-1));
Logged

WC

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 22
Re: Give Admin-Access to Certain Scripts for a Specified Group
« Reply #28 on: June 11, 2007, 10:51:23 pm »

Quote
1) 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?

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:

Code: [Select]
$mod_usergroups = explode(',',substr(USER_GROUP_SET,1,-1));
to this:

Code: [Select]
$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

Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Give Admin-Access to Certain Scripts for a Specified Group
« Reply #29 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.

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.
Logged

Riccardo83

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 38
Re: >Check if you belong to a group instead of checking if you ar an admin
« Reply #30 on: October 04, 2008, 05:01:19 pm »

Would this code work for vBulletin too?


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:
Code: [Select]
// 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);
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: >Check if you belong to a group instead of checking if you ar an admin
« Reply #31 on: October 05, 2008, 12:33:20 pm »

Would this code work for vBulletin too?
Did you bother to read the post just one above yours:
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:
We can't tell, since none of the devs is using vb.
Logged
Pages: 1 [2]   Go Up
 

Page created in 0.025 seconds with 20 queries.