XF 2.0 Admin Panel Restrictions/Permissions set up

mcloutier87

Member
I was wondering if there was a way to grant admin panel access with permissions/restrictions.

Example: So I can make user only see Forums and Nodes in the "admin crtl panel menu" "Forum-Nodes".

Would I be able to set specific nodes for the user to see.

I run multiple gaming servers.
So i wouldn't want game 1 manager having access to game 2 nodes in Admin Crtl Panel Menu.

Thank you. If i am not clear enough to what it is I want let me know please.
 
That is not possible out of the box and I am not aware of an addon which could do this.

You can limit admins permission in like which areas of the admin panel they can use/access. Like "manage nodes". But once an admin can manage nodes, it can manage all of them.

Why would you need an admin per node btw.?
 
That is not possible out of the box and I am not aware of an addon which could do this.

You can limit admins permission in like which areas of the admin panel they can use/access. Like "manage nodes". But once an admin can manage nodes, it can manage all of them.

Why would you need an admin per node btw.?
My community plays 4 different games. Some games have multiple mods. Each game has a manager to take care of things and help me around the forums. I would like it if Game 1 Manager couldn't see Game 2 Manager nodes in the admin control panel. It helps cause each game is separate and some category's have pages that need adjusting every so often in the admin control panel. I'm the one stuck doing these adjustments. So im trying eliminate some work for me and as well put some trust into the managers while still remaining careful.
 
I am quite sure, that there is no addon, that can do this. But I think it would be quite easy to build one*

1) Add a permission manageAnyNode for your addon. This permission is necessary for you and all admins who should be able to edit all nodes and add ones.

2) a class extension for XF\Admin\Controller\Node:
PHP:
<?php

namespace Your\Addon\XF\Admin\Controller;

use XF\Mvc\ParameterBag;

class Node extends XFCP_Node
{
    protected function preDispatchController($action, ParameterBag $params)
    {
        parent::preDispatchController($action, $params);

        $visitor = \XF::visitor();

        if ($this->isPost())
        {
            if (!$params['node_id'])
            {
                throw $this->exception($this->noPermission());
            }

            if (!$visitor->hasPermission('yourAddon', 'manageAnyNode') && !$visitor->hasNodePermission($params['node_id'], 'manageAnyThread'))
            {
                throw $this->exception($this->noPermission());
            }
        }
    }
}
3) a class extension for XF\Admin\Controller\Permission:
PHP:
<?php

namespace Your\Addon\XF\Admin\Controller;

class Permission extends XFCP_Permission
{
    protected function preDispatchController($action, ParameterBag $params)
    {
        parent::preDispatchController($action, $params);

        $visitor = \XF::visitor();

        if (!$visitor->hasPermission('yourAddon', 'manageAnyNode'))
        {
            throw $this->exception($this->noPermission());
        }
    }
}

4) add the "nodes" admin permission to a moderator, but don't add him to the admin user group!

This is just a skeleton. Untested! There may also be other/better approaches (maybe an admin permission instead of a normal one would be better..). Your moderators will see the whole "nodes" section, but won't be able so "post" anything, so I am quite sure, that they won't be able to save anything outside of the forums they have the "manageAnyThread" right for.

Note: addons that don't have their own admin permission (which is a bad practice) will be also accessible to your moderators.

* o.k. not too easy, but as I have already started writing these lines, I wanted to finish it :)
 
My community plays 4 different games. Some games have multiple mods. Each game has a manager to take care of things and help me around the forums. I would like it if Game 1 Manager couldn't see Game 2 Manager nodes in the admin control panel. It helps cause each game is separate and some category's have pages that need adjusting every so often in the admin control panel. I'm the one stuck doing these adjustments. So im trying eliminate some work for me and as well put some trust into the managers while still remaining careful.
I understand and this is how most forums handle things. Like they have moderators seperate for each node. But moderators are supposed to have permissions only for the frontend and the XF system allows you to do that for moderators.

As explained for administrators, who administrate the backend (Admin Control Panel) don't have that seperation for nodes. The seperation only is for specific areas of the ACP.

What makes me curious is that what kind of stuff you have that you need to adjust the nodes every so often?
Usually once the nodes are set with their permissions, 99.9% of the time you never change a thing in that particular area.
What type of stuff has a game manager to do on ACP in the nodes section? I am just curious.
 
What makes me curious is that what kind of stuff you have that you need to adjust the nodes every so often?

Some examples:
-When we add new "game Admin" to the games/mods we host. The node page with html code displaying the staff names nicely needs to be adjusted.
-Same with rules for certain custom mods in Games when game players exploit the rules. The manager of that game needs to go into the Node Rules page and make the changes necessary to the html code.
 
  • Like
Reactions: sbj
Back
Top Bottom