Prevent deletion of built-in permission roles

General discussion of development ideas and the approaches taken in the 3.x branch of phpBB. The next feature release of phpBB 3 will be 3.2/Rhea followed by 3.3.
Forum rules
Please do not post support questions regarding installing, updating, or upgrading phpBB 3.1. If you need support for phpBB 3.1 please visit the 3.1.x Support Forum on phpbb.com.

If you have questions regarding writing extensions please post in Extension Writers Discussion to receive proper guidance from our staff and community.
Post Reply
skouat
Registered User
Posts: 13
Joined: Tue Mar 01, 2011 11:19 pm

Prevent deletion of built-in permission roles

Post by skouat » Thu Nov 24, 2016 7:35 am

Hi all !

Although this is rare, admins can delete built-in permissions roles.
As some extension can use them during the installation process, if roles are no longer available, the extension installation failed.

Senky
Extension Customisations
Extension Customisations
Posts: 283
Joined: Thu Jul 16, 2009 4:41 pm

Re: Prevent deletion of built-in permission roles

Post by Senky » Thu Nov 24, 2016 8:42 am

Well, then check for permission existence in your migration :)

User avatar
kasimi
Extension Customisations
Extension Customisations
Posts: 13
Joined: Thu May 24, 2012 1:54 pm

Re: Prevent deletion of built-in permission roles

Post by kasimi » Thu Nov 24, 2016 2:28 pm

I think the migrator should take care of this. If the role doesn't exist, the permission.permission_set operation should be skipped, without throwing an error. Admins who delete built-in roles should know that extension won't be able to set default permission values.

Either that, or don't allow deleting built-in roles in the first place.

User avatar
brunoais
Registered User
Posts: 958
Joined: Fri Dec 18, 2009 3:55 pm

Re: Prevent deletion of built-in permission roles

Post by brunoais » Thu Nov 24, 2016 2:33 pm

I'd go for: The admin can always delete any role he chooses to but he should get an extra warning if he is trying to delete a builtin role. If he still decides to delete it, then it was his conscious choice.

Post Reply