XF 2.1 Adding new permissions to the resource manager and media gallery add-ons

Lawrence

Well-known member
I'm working on a new add-on that will work with XFRM and XFMG, if installed. What is the best way to add relevant permissions for those add-ons? I tried adding resource permissions to my add-ons permission group, but when I disabled the resource manager those permissions remained displayed (I thought they would disappear, and then re-appear when I re-enabled the resource manage).

I could check for those two add-ons when my add-on is being installed and add those permissions in for XFRM and XFMG if present, the problem with that is if they are not installed I would need another listener to check to see when an add-on is being installed is it one of those two, and if so add the permissions in then. That approach does not seem to be an efficient way of handling this.

For those of you that created an add-on that works with XF, XFRM, and XFMG how did you handle permissions if one or neither of those add-ons were not installed?

Thank you for any suggestions.
 
I could check for those two add-ons when my add-on is being installed and add those permissions in for XFRM and XFMG if present
Add those permissions how?

For those of you that created an add-on that works with XF, XFRM, and XFMG how did you handle permissions if one or neither of those add-ons were not installed?
@Xon's Content Title Edit History add-on does this with the help of InstallerListener class which make use of addon_post_rebuild and addon_post_install code event listeners.
 
Add those permissions how?
Inserting an XML file that contains the relevant permissions, at least that was a plan I thought of. I did use that approach for a vB plugin if I remember correctly as it's been many moons ago.

@Xon's Content Title Edit History add-on does this with the help of InstallerListener class which make use of addon_post_rebuild and addon_post_install code event listeners.

There is this too. But I think this is getting overly complicated for just wanting to add a couple of permissions.

I think my best option is to just convert the permissions I want to use in the resource manager and media gallery into options. And have the option callback check to see if they are installed or not. First, I have another option I just thought of, that I want to see if it can be done or not.

Thanks again for your response @TickTackk, always appreciated.
 
Inserting an XML file that contains the relevant permissions, at least that was a plan I thought of. I did use that approach for a vB plugin if I remember correctly as it's been many moons ago.
Personally, I don't like this method because of the complications it might involve later one.

There is this too. But I think this is getting overly complicated for just wanting to add a couple of permissions.
The InstallListener is just for managing the default permission values and not for adding permissions manually.

I think my best option is to just convert the permissions I want to use in the resource manager and media gallery into options.
You could try extending permission_macros::edit_groups and permission_macros::content_edit_groups to do basic if permission interface group id === ??? and !is_addon_active('<add-on id goes here')> to hide the permission interface group completely or extending XF:Permission but I haven't personally tried either of those to know the side affects it might cause.

Thanks again for your response @TickTackk, always appreciated.
1602518147066.webp
 
or extending XF:Permission but I haven't personally tried either of those to know the side affects it might cause.

Actually, this is what I was thinking of trying. I just haven't gotten to that yet as I'm cleaning up other areas of the add-on before I move on to include resources.
 
Well, I decided to have resource permissions and media permissions added via their own mini add-ons. If an admin has the resource manager installed (for example), or decide to install it later, they can choose to download the appropriate mini-add-on. The back-end of the main add-on already checks to see if XFRM or XFMG is installed, so no changes are required by the mini add-ons for that side. This approach will also save on over-head as the code required for the front end will be shipped with the mini-add-ons, including class extensions, phrases, TM's etc. The mini add-ons will be useless without the main add-on installed (a requirement check will be made when installing each mini add-on).

Doable, :)
 
Top Bottom