Jump to content

Limit Admin CP


Guest Haku2

Recommended Posts

Outlaw,


Say Matt didn't include a custom admin privleges feature in 2.1.0. Would you do a mod for it? I know your busy, but would you consider it even?


<{POST_SNAPBACK}>



I wish that too, I knew if Outlaw put his mind in something, sure he can do it right, or atlease work where Dean left off.

But I wish Matt add this to 2.1 and make most members happy, my best.
Link to comment
Share on other sites

  • 2 weeks later...

Well, I hope this gets added. I think this would be a good very good feature to be added. I think it will make a lot of customers happy. Then some people could only access the skins section if they are skinner. When limiting the Admin CP you can set it so someone does not change the settings that you do not want.

Link to comment
Share on other sites

  • 7 months later...

I don't know if anyone still needs this since 2.1 is already out. But the current beta version is quite buggy and I am not intending to install it untill they have finalize it.

NB: I am not a professional but my site needs this too as I do not want some newer admins to mess up the boards. I have done this with success so I am sharing what I've found out.

To have admin group and restricted admin group, one way is to have 2 different menus. Meaning, root admin logs in to see one menu, restricted admin logs in to see ANOTHER SET of menu.

To do this, you have to manually edit two files:
admin_pages.php &
admin_functions.php

In admin_pages.php, you can see the following pattern:
$PAGES = ..
$CATS = ..
$DESC = ..
which decides what you will see in ACP.

At the bottom of that chunck, decide on the menu which you want your secondary admin to see. Follow the pattern in the above chunck, in this manner:
$PAGES1[(count($PAGES) + 1) * 100] = ..
$CATS1[(count($CATS) + 1) * 100] = ...
$DESC1[(count($DESC) + 1) * 100] = ..

EXAMPLE:

$PAGES1[(count($PAGES) + 1) * 100] = 	array(				



							1 =>array( 'Custom Pages'   , 'act=pages' ),

							2 => array( 'HB Banner Changer', 'act=op&code=setting_view&conf_group=26'),

							3 => array( 'Manage Badword Filters', 'act=admin&code=badword'	 ),

							4 => array( 'Manage Ban Filters'	, 'act=admin&code=ban'  ),

							5 => array( 'Manage Help Files'	 , 'act=help'				   ),

							 6 => array( 'Task Manager'		, 'act=task'				),

							 7 => array( 'View Task Logs'	  , 'act=task&code=log'	   ),

					);

$CATS1[(count($CATS) + 1) * 100] =array("Normal Settings"   , '#caf2d9;margin-bottom:12px;' );

$DESC1[(count($DESC) + 1) * 100] ='Edit some forum settings as such ';


$PAGES1[(count($PAGES) + ........

................

after doing this, you would have customised your secondary admin group's menu. === Next is to edit admin_functions.php Go down to:

	// MENU:

	//

	// Build the collapsable menu trees

add "$PAGES1, $CATS1, $DESC1" for definitions for function menu() , function build_tree() and function build_jump_menu(), for example

	function build_tree()

	{

		global $ibforums, $std, $PAGES, $CATS, $DESC, $PAGES1, $CATS1, $DESC1;

The crucial edits are done in function build_tree() For non-restricted admin users (normal and root), keep the codes in the chunck under foreach($CATS as $cid => $data) { .... } For restricted admin users, copy and paste from foreach($CATS as $cid => $data) { .... } and paste below return $html; In this copied chunck, change $CATS to $CATS1, $PAGES.. etc , $cid to $cid1, $pid to $pid1. (This codes with "$CAT1", "$PAGES", etc... will capture the menu for your restricted admin. Those that you have customised in admin_pages.php from previous step) Next do the permission check. For permission checking, you may need to add the following before the line "foreach($CATS..." and "foreach($CATS1...") For EXAMPLE 1 Root admin and user 5 may see this menu if (($ibforums->member['mgroup'] == $ibforums->vars['admin_group']) or ($ibforums->member['id'] == 5)) 2 Non-Root admin may NOT see the menu if ($ibforums->member['mgroup'] != $ibforums->vars['admin_group']) 3. Only user ID 5 can see if ($ibforums->member['id'] == 5) (other special permission, customize yourself) As an example: Your codes for following requirements: - allow normal admin and user 5 to see "normal ACP menu" + "Restricted menu" - disallow restricted admin to see the normal ACP menu - restricted admin CAN ONLY SEE the menu customised for them should look like this (see my explanation in //<<...>>):

	function build_tree()

	{

		global $ibforums, $std, $PAGES, $CATS, $DESC, $PAGES1, $CATS1, $DESC1;


		$html  = "";

		$links = "";


		$collapsed_ids = ",".$std->my_getcookie('acpcollapseprefs').",";


// <<allow normal admin and user 5 to see "normal ACP menu" + "Restricted menu">>

if (($ibforums->member['mgroup'] == $ibforums->vars['admin_group']) or ($ibforums->member['id'] == 5))


// <<keep these for normal and root admin>>

		foreach($CATS as $cid => $data)

		{

		.........			

			foreach($PAGES[ $cid ] as $pid => $pdata)

			{

		..........

				$links .= $ibforums->adskin->menu_cat_link($pid, $cid, $pdata[1], $pdata[0], $pdata[3], $pdata[4]);

			}


		.........

		}

// <<these codes for RESTRICTED MENU, notice $CATS1, $cid1, $pid1, etc>>


		foreach($CATS1 as $cid1 => $data)

		{

		......

// <<notice the codes are SAME AS ABOVE EXCEPT $CATS1, $PAGES1, ETC>>		

			$this->menu_ids[] = $cid1;

		.........

			foreach($PAGES1[ $cid1 ] as $pid1 => $pdata)

			{


		..........

				}


				$links .= $ibforums->adskin->menu_cat_link($pid1, $cid1, $pdata[1], $pdata[0], $pdata[3], $pdata[4]);

			}


		.....................


		}


		return $html;

}

// <<close for normal admin menu>>

else

{

//<<for restricted admin's view. He can only see these>>

if ($ibforums->member['mgroup'] != $ibforums->vars['admin_group'])


		foreach($CATS1 as $cid1 => $data)

		{

		...............			

		(SAME AS SIMILAR CHUNK ABOVE)

		}


		return $html;

}

	}

============= In function build_jump_menu() add after the whole chunck: foreach($CATS as $cid => $name) { .... } Add this after

		foreach($CATS1 as $cid1 => $name)

		{

			$html .= "<optgroup label='$name[0]'>\n";


			foreach($PAGES1[ $cid1 ] as $pid1 => $pdata)

			{

				$html .= "<option value='$pdata[1]'>$pdata[0]</option>\n";

			}


			$html .= "</optgroup>\n";

		}



Once it is completed, you can try logging in with your root admin and another test account holding on to normal admin (give the account no access to normal view)

Normal(and root) admin log in to see this rootadminmenu.jpg

Restricted admin log in to see this normaladminmenu.jpg

NB: This works for 2.0.x. Ver2.1 has this feature but if you are not intending to install 2.1 till they release a stable version, you may try this.

Link to comment
Share on other sites

I don't know if anyone still needs this since 2.1 is already out. But the current beta version is quite buggy and I am not intending to install it untill they have finalize it.



NB: I am not a professional but my site needs this too as I do not want some newer admins to mess up the boards. I have done this with success so I am sharing what I've found out.



To have admin group and restricted admin group, one way is to have 2 different menus. Meaning, root admin logs in to see one menu, restricted admin logs in to see ANOTHER SET of menu.

Dude please don't take this the wrong way, but Betas are supposed to be buggy. Well let me restate that, the purpose of it being a beta is to find and correct the bugs. From the rest of your suggestion, it would appear (and I could be wrong) that you haven't even tested out any of the betas yet.

The way that the admin restriction is being done is outstanding. Yes, there are a few bugs in it which I'm sure Matt will knock out, but it permits each admin to be given different levels/amounts of access, far beyond what your suggestion/method offers (it's not a put down, please don't take it as such).

If you haven't tried out the beta, then you should give it a test run as a separate board, even testing out a COPY of your live forum database. (By copy, I do mean to back it up and then import the backup to a test database, I recommend not using it on a live board). Not only would this allow you to see what's available and offered, but if you find any problems not yet discovered, then you can report it so that it can get fixed.

I think that you'll really like the method that Matt has chosen for limiting admin access control. I feel the same as you though; I'm running a rather small forum, but a main reason that I have never shared AdminCP control is from not having the ability to limit access. Sure, it's really nothing too important that would get lost, but why risk it? If you want to see what the new AdminCP looks like, you can see some screen shots and .mov files on Matt's blog. It will simply amaze you.

Give the Beta 5 a try, I think you'll like it. :thumbsup:
Link to comment
Share on other sites

Dude please don't take this the wrong way, but Betas are supposed to be buggy.



.....


If you haven't tried out the beta, then you should give it a test run as a separate board, even testing out a [b]COPY[/b] of your live forum database. (By copy, I do mean to back it up and then import the backup to a test database, I recommend not using it on a live board). Not only would this allow you to see what's available and offered, but if you find any problems not yet discovered, then you can report it so that it can get fixed.


....


Give the Beta 5 a try, I think you'll like it. :thumbsup:


Hi Wolfie,

Not at all... :thumbsup:

Anyway, I have always wanted to do a TEST forum for 2.1 but I am not really sure how to go about it and worried that I might screw up my current board somehow.

Apart from what you have suggested on the database, do I need to edit my "conf_global.php" to suit the new test database?

So I upload all the BETA5 files into a new forum folder call "forum_test", then in my cpanel I duplicate a new database. And I edit the "conf_global.php" file accordingly...

That's all right? Then I will have a separate board unrelated to my current live board, right?
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...