News:

Want to get involved in developing SMF? Why not lend a hand on our GitHub!

Main Menu

Restrict Admin

Started by Neons, October 13, 2008, 09:22:44 AM

Previous topic - Next topic

Neons

Hello

I have set up a website for my World of Warcraft guild using Tinyportal and SMF. However, since I'm just a normal member of the guild, the officers would like to restrict me from seeing certain boards (the officer boards, obviously). Is there ANY way of doing this without demoting me?

Thanks

Marcus Forsberg

Boards > the officer boards > Modify

Uncheck ALL membergropus in there, and only admins will see it.

Neons

Wow, that was a quick reply. However, thats not what I want. You see, I am an Admin myself, but I don't want to see the boards. Only the members of the Officer membergroup should. So I ask again, is there any way of restricting an admin from seeing a certain board? :)

Kermit

#3
Maybe that can help you


First you should create sth. for your Office group on Load.php


Sources/Load.php

Code (find) Select
'is_admin' => in_array(1, $user_info['groups']),

Code (add after) Select

'is_officer' => in_array(x, $user_info['groups']),


x should be replace with the group id of officer group


Sources/Display.php

Code (find) Select

// Load the proper template and/or sub template.
if (WIRELESS)
$context['sub_template'] = WIRELESS_PROTOCOL . '_display';
else
loadTemplate('Display');


Code (add after) Select

if ($GLOBALS['board'] == "y.0")
    {
       if ($user_info['is_admin'] || !$user_info['is_officer'])
            fatal_error('Restricted Area,just the officers !', false);
    }




Sources/MessageIndex.php

Code (find) Select

if (WIRELESS)
$context['sub_template'] = WIRELESS_PROTOCOL . '_messageindex';
else
loadTemplate('MessageIndex');



Code (add after) Select

if ($GLOBALS['board'] == "y.0")
    {
       if ($user_info['is_admin'] || !$user_info['is_officer'])
            fatal_error('Restricted Area,just the officers !', false);
    }



And if you dont want it,that admin can see the messages via sa=showPosts

You should do this



Themes/default/Profile.template.php

Code (find) Select

// For every post to be displayed, give it its own subtable, and show the important details of the post.
foreach ($context['posts'] as $post)
{


Code (add after) Select

if ($post['board']['id'] == "y.0" )
    {
     
    }

else
{




Code (find) Select

}

// Show more page numbers.
echo '
<table border="0" width="85%" cellspacing="1" cellpadding="4" class="bordercolor" align="center">


Code (add before) Select

}





again y.0 should be replaced with id of Officer's Board



With that small modification admins and the other groups just can see the board on the main page ,but when they try to enter the board,they will see the error message Restricted Area,just the officers,i hope,that's what you want 
My Mods
Please don't PM/mail me for support,unless i invite you
Formerly known as Duncan85
Quote
"Two things are infinite: the universe and human stupidity; and I'm not sure about the the universe."

A. Einstein

Marcus Forsberg

That's not needed at all, Duncan. You cna restrict all groups except admins like I said above.

Kermit

Quote from: Nascar on October 13, 2008, 10:23:11 AM
That's not needed at all, Duncan. You cna restrict all groups except admins like I said above.

but as you see here


Quote from: neon401 on October 13, 2008, 09:26:58 AM
Wow, that was a quick reply. However, thats not what I want. You see, I am an Admin myself, but I don't want to see the boards. Only the members of the Officer membergroup should. So I ask again, is there any way of restricting an admin from seeing a certain board? :)


He wants with admin too
^^
My Mods
Please don't PM/mail me for support,unless i invite you
Formerly known as Duncan85
Quote
"Two things are infinite: the universe and human stupidity; and I'm not sure about the the universe."

A. Einstein

Neons

#6
Thanks alot Duncan! Is there a way to specify multiple boards for restriction? Say, I have Officer Board 1 and Officer Board 2 which I want to restrict, how would I go about doing this?

Or even better, restrict a whole category instead!

Again, thanks alot :)

EDIT:
Quote from: nightbre on October 13, 2008, 10:36:23 AM
IMO its a bit stupid for admin to not see all boards since if they do have issues they will be powerless to fix them.

Also as a guild GM even in officer boards we dont chat about guild members in a way that would make us need to hide anything from other members should access be needed.I know our guilds will be different but you see the point im trying to make here,your doing them the favour after all.

Just my opinion on the way your being asked to do this.
I agree it's stupid, but I don't really care, I just want my GM to be happy. There really isn't a point in restricting me from seeing the boards since I could, if i wanted, just edit back the files Duncan posted above and I'd be able to see the boards again. But unlike your guild officers, mine likes to talk about the other members in a way that the discussion need to be hidden. But thanks for your input though, I agree with it ;)

Kermit

#7
Quote from: neon401 on October 13, 2008, 10:48:08 AM
Thanks alot Duncan! Is there a way to specify multiple boards for restriction? Say, I have Officer Board 1 and Officer Board 2 which I want to restrict, how would I go about doing this?

sure instead of that if expression

if ($GLOBALS['board'] == "y.0")

you should use sth like that

if ($GLOBALS['board'] == "y.0" || if ($GLOBALS['board'] == "z.0") )



Quote from: neon401 on October 13, 2008, 10:48:08 AM
Or even better, restrict a whole category instead!

Again, thanks alot :)


BoardIndex.template.php

Code (find) Select
global $context, $settings, $options, $txt, $scripturl, $modSettings;


Code (replace) Select
global $context, $settings, $options, $txt, $scripturl, $modSettings, $user_info;



Code (find) Select

/* Each category in categories is made up of:
id, href, link, name, is_collapsed (is it collapsed?), can_collapse (is it okay if it is?),
new (is it new?), collapse_href (href to collapse/expand), collapse_image (up/down image),
and boards. (see below.) */
$first = true;
foreach ($context['categories'] as $category)
{


Code (add after) Select

if (($category['id'] == "c") && (!$user_info['is_officer']))
{

}
else
{


instead of again category id


Code (find) Select

</table>';
}
echo '
</div>';
}


Code (add after) Select

}
My Mods
Please don't PM/mail me for support,unless i invite you
Formerly known as Duncan85
Quote
"Two things are infinite: the universe and human stupidity; and I'm not sure about the the universe."

A. Einstein

reddshack

I had a similar requirement for my board where I was the Admin/Owner but I wasn't supposed to see all boards. The easiest solution I came to without having to mod the templates was to just create a new user account and assign that as the Administrator (the one without any restrictions) and removed my main account from being an Administrator. Then I created a new membergroup called Super Admin and granted it every permission without checking any allowed boards, and assigned myself to that group. Now I have virtually every permission I need in my normal account and can only see the boards I'm supposed to. When something needs to get done beyond my permissions (very rarely) I log in as the Administrator and do it, then log out when I'm finished and resume my usual forum activities.

Advertisement: