Jump to content

ACP restrictions won't show up


Adriano Faria

Recommended Posts

Hi there,

Just noticed, after a user report, that one of my apps has no ACP restrictions:

ZLfrJiH.png&key=55a605d1c143587bbe69f5e8

kXJZLlG.png&key=2a7f5b8e0c380d60aa76e15d

Althougt everyhing is there, it doesn't appear. Example:

Model:

	protected static $restrictions = array(
		'app'		=> 'tutorials',
		'module'	=> 'tutorials',
		'prefix'	=> 'categories_'
	);

Controller:

	/**
	 * Execute
	 *
	 * @return	void
	 */
	public function execute()
	{
		\IPS\Dispatcher::i()->checkAcpPermission( 'categories_manage' );
		parent::execute();
	}

ACP menu:

NTEe6vc.png&key=db707c239a824e2ea3ae3345

 

Editing a menu:

kLN9PYM.png&key=c58d022e3792be4a54be7bc7

acprestrictions.json:

{
    "tutorials": {
        "categories": {
            "categories_manage": "categories_manage",
            "categories_add": "categories_add",
            "categories_edit": "categories_edit",
            "categories_delete": "categories_delete",
            "categories_permissions": "categories_permissions"
        },
        "fields": {
            "fields_manage": "fields_manage",
            "fields_add": "fields_add",
            "fields_edit": "fields_edit",
            "fields_delete": "fields_delete"
        },
		"tools": {
            "tools_manage": "tools_manage"
        },
        "settings": {
            "settings_manage": "settings_manage"
        }
    },
    "stats": {
        "tutorials": {
            "tutorials_manage": "tutorials_manage",
            "comments_manage": "comments_manage",
            "submitters_manage": "submitters_manage"
        }
    }
}

Basically, it is like Downloads or any other app I've developed and it works for the others.

So debugging IPS\core\modules\admin\applications\developer _manageAcprestrictions()  I see the json is OK:

QgbDufr.png&key=56ecc5ced297887cdff33ec4

So I'm not sure why it doesn't appear.

Any suggestion?

Link to comment
Share on other sites

	public function restrictionsGetRoots()
	{
		$rows = array();

		if( !empty( $this->modules['admin'] ) )
		{
			foreach ( $this->modules['admin'] as $k => $module )
			{
				if ( empty( $module['protected'] ) )
				{
					$rows[] = $this->_restrictionsModuleRow( $this->url, $k, $this->restrictions, FALSE );
				}
			}
		}
		return $rows;
	}

To get the rows to show we loop over admin modules and only show them if the module isn't flagged as protected, that's why I was asking.

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