Jump to content

Module: Dynamic Roles (for PW 2.4.6+)


Recommended Posts

I'm currently missing a quite useful feature in the module. I've the following setup to prevent unnecessary verbosity, where client accounts are defined like so: role=client, company=SomeCompany (page field). This way I just need to define each company in a single place as well as handle the client role permissions and access rules once. Now I've a list of projects, where clients should only be able to see those projects, where the company field does hold their assigned company. This is certainly possible with dynamic roles right now, but it's introducing the verbosity that I tried to avoid, meaning I need to have at least a single drole per client. I'd much rather use a single drole to handle all clients and assign them view access like so: template=project, client=user.client.

From looking into the code I think this would mostly be another "where" check for mysql queries and the runtime permission checks should be even more simple to implement. 

@renobird I'm not sure if you still need it, but dynamic roles do not work on admin pages (process modules). See this for a working solution: https://processwire.com/talk/topic/6822-module-dynamic-roles-for-pw-246/page-3#entry98415

  • Like 1
Link to comment
Share on other sites

  • 9 months later...

I'm using DynamicRoles on PW 3.0.33 and I get errors:

As superuser:

PagesLoader: Class 'DynamicRole' for Pages::getById() does not exist

As "dynamicroles" user :

Error: Exception: Method Page::hasEditPermission does not exist or is not callable in this context (in C:\inetpub\wwwroot\wire\core\Wire.php line 410)

#0 C:\inetpub\wwwroot\wire\core\Page.php(1475): ProcessWire\Wire->___callUnknown('hasEditPermissi...', Array)
#1 [internal function]: ProcessWire\Page->___callUnknown('hasEditPermissi...', Array)
#2 C:\inetpub\wwwroot\wire\core\Wire.php(348): call_user_func_array(Array, Array)
#3 C:\inetpub\wwwroot\wire\core\WireHooks.php(548): ProcessWire\Wire->_callMethod('___callUnknown', Array)
#4 C:\inetpub\wwwroot\wire\core\Wire.php(371): ProcessWire\WireHooks->runHooks(Object(ProcessWire\Page), 'callUnknown', Array)
#5 C:\inetpub\wwwroot\wire\core\Wire.php(372): ProcessWire\Wire->__call('callUnknown', Array)
#6 C:\inetpub\wwwroot\wire\core\Wire.php(372): ProcessWire\Page->callUnknown('hasEditPermissi...', Array)
#7 C:\inetpub\wwwroot\site\assets\cache\FileCompiler\site\modules\DynamicRoles\DynamicRoleSupport.module(178): ProcessWire\Wire->__call('hasEdi

This error message was shown because: site is in debug mode. ($config->debug = true; => /site/config.php). Error has been logged.

It's working on 2.5.4. Any help is welcome :-)  

  • Like 1
Link to comment
Share on other sites

  • 4 weeks later...

Is DynamicRoles meant to be compatible with PW 3.x at this time? I would love to use it to control Page Publish permissions in a new installation.

I see gitHub mentions of correcting installation on 2.8/3.0 but the description only mentions 2.4.5+ and I don't see a lot of recent activity for the module there.

Or has some new module/Process replaced this?

Link to comment
Share on other sites

  • 10 months later...

Hi, what would it take to make a certain drole only work on certain pages? Like if the "What can they view" selector would behave as "Where does this drole apply"

My Situation:

I have an editor I want to be able to edit all german translations. I want the same editor to be able to edit all translations on a specific page (his city)

I create 2 droles

1. Edit rights to his city (Page ID 1234) with permission page-edit-lang-de page-edit-lang-defualt

2. Edit rights to all Pages of a certain Template and only page-edit-lang-de

Now, thes two droles get combined and result in the user having edit rights on all pages (2. Drole) with german and default language.

Now, if the view selector would instead restrict the drole to have only effect on the selected page(s) – this would solve my problem (and probably those of many others since this would allow for truely dynamic role model.

Does this description make sense?

Link to comment
Share on other sites

  • 3 months later...
  • 11 months later...
  • 2 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...