[3.2 to 3.3] Extension-specific permissions stopped working

Discussion forum for Extension Writers regarding Extension Development.
Post Reply
Unweliath
Registered User
Posts: 45
Joined: Sat Jan 14, 2017 5:25 pm

[3.2 to 3.3] Extension-specific permissions stopped working

Post by Unweliath »

Hi all,
I am currently working on upgrading tas2580's usermap extension - which he doesnt maintain anymore - to 3.3.3. Up until 3.2.7 it worked fine.

First step was to upgrade the yamls according to the new scheme: https://github.com/jbreu/usermap/commit ... e1fbb8caaa

However, I am struggling now with the fact that the extra permissions dont show up in ACP anymore. The extension-specific settings however are working normally, and I dont get any error messages in any log I know (php/apache error log, activated DEBUG setting in config.php).

I have studied https://area51.phpbb.com/docs/dev/3.3.x ... sions.html closely, and I cannot find any point where tas2580 did it not in the up-to-date manner:

- Create permissions:

https://github.com/jbreu/usermap/blob/m ... le.php#L72

Code: Select all

			// Add permissions
			array('permission.add', array('u_usermap_view', true, 'u_')),
			array('permission.add', array('u_usermap_add', true, 'u_')),
			array('permission.add', array('u_usermap_search', true, 'u_')),
			array('permission.add', array('u_usermap_hide', true, 'u_')),
			array('permission.add', array('u_usermap_add_thing', true, 'u_')),
			array('permission.add', array('u_usermap_comment', true, 'u_')),
			array('permission.add', array('m_usermap_comment_delete', true, 'm_')),
			array('permission.add', array('m_usermap_comment_edit', true, 'm_')),
			array('permission.add', array('m_usermap_place_edit', true, 'm_')),
			array('permission.add', array('m_usermap_place_delete', true, 'm_')),
- Define permissions

https://github.com/jbreu/usermap/blob/m ... ap.php#L37

Code: Select all

$lang = array_merge($lang, array(
	'ACL_CAT_USERMAP'				=> 'User Map',
	'ACL_U_USERMAP_VIEW'		    => 'Can view the user map',
	'ACL_U_USERMAP_ADD'		        => 'Can add themselves to the user map',
	'ACL_U_USERMAP_SEARCH'	        => 'Can search the user map',
	'ACL_U_USERMAP_HIDE'			=> 'Can hide own location on user map',
	'ACL_U_USERMAP_ADD_PLACE'		=> 'Can add point of interest to user map',
	'ACL_U_USERMAP_DELETE_PLACE'	=> 'Can delete point of interest from user map',
	'ACL_U_USERMAP_EDIT_PLACE'		=> 'Can edit point of interest on user map',
));
- Wire up permissions

https://github.com/jbreu/usermap/blob/m ... r.php#L102

Code: Select all

		$permissions = $event['permissions'];
		$permissions += array(
			'u_usermap_view'	=> array(
				'lang'		=> 'ACL_U_USERMAP_VIEW',
				'cat'		=> 'usermap'
			),
			...
		);
		$categories['usermap'] = 'ACL_CAT_USERMAP';
		$event['categories'] = array_merge($event['categories'], $categories);
		$event['permissions'] = $permissions;
The listeners in general seem to be set up right, the Extension settings in ACP can be set as usual. Its just that the permissions dont appear in any group permission view.
I already compared everything to other extensions but I dont have any further idea how to debug this. Any help/hints are appreciated.
Unweliath
Registered User
Posts: 45
Joined: Sat Jan 14, 2017 5:25 pm

Re: [3.2 to 3.3] Extension-specific permissions stopped working

Post by Unweliath »

Hi all,

anyone has any idea how to investigate this? I am stuck with this ever since the initial post.
User avatar
MattF
Extensions Development Coordinator
Extensions Development Coordinator
Posts: 5859
Joined: Sat Jan 17, 2009 9:37 am
Location: Los Angeles, CA
Name: Matt Friedman

Re: [3.2 to 3.3] Extension-specific permissions stopped working

Post by MattF »

You need a space before && in all these lines like ext_tas2580/usermap&& acl_a_board in your acp/usermap_info file.
Formerly known as VSEMy ExtensionsPlease do not PM me for support.
Unweliath
Registered User
Posts: 45
Joined: Sat Jan 14, 2017 5:25 pm

Re: [3.2 to 3.3] Extension-specific permissions stopped working

Post by Unweliath »

MattF wrote: Wed Mar 10, 2021 8:05 pm You need a space before && in all these lines like ext_tas2580/usermap&& acl_a_board in your acp/usermap_info file.
Thanks for your suggestion, Matt. I tried it but it didnt change anything. I am still clueless how to debug such things.
Sorry for not reacting earlier, somehow I didnt activate notifications for my own threads, so I simply missed it.
User avatar
3Di
I've Been Banned!
Posts: 17538
Joined: Mon Apr 04, 2005 11:09 pm
Location: I'm with Ukraine 🇺🇦
Name: Marco
Contact:

Re: [3.2 to 3.3] Extension-specific permissions stopped working

Post by 3Di »

Your way of declaring permissions is not right IMHO. Morever, you can declare them (the right way) but you also have to SET them.

Have a look at all of the extensions already validated (or done by trusted coders) how they did that.
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Buy me a coffee -> Image
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
Post Reply

Return to “Extension Writers Discussion”