ryancramerdesign / dynamicroles Goto Github PK
View Code? Open in Web Editor NEWDynamic Roles for ProcessWire
Dynamic Roles for ProcessWire
Session: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '1008-122563' for key 'PRIMARY'
Sometimes when I save the DynRole I get this.
I tried to define the "Where can add pages" filter. But when looking in the DB table there's no entries. And also it's not working, say the user can't add pages where I defined.
There's so many wierd things going on everytime I try this module I don't know what to do or start and assume.
Some experience:
Sometimes I add rules and I have to save the affected role again in the admin to get it working.
Sometimes I get dublicate entry.
Sometimes I define a "where to add pages" but in the db the table stays empty (pages_access_droles_add) But after deleting and creating the dynrole again there suddenly are entries in the db table. Still the feature isn't working without giving explicit access on template level.
I am building a site with customized backend. There are a lot of different permissions which tend to be added often. For example, I have a catlogue with items having page field. I need to limit edit permissions to the items based on the user data end the value of the page field. Dynamic roles seem to be ideal for that, but the page field values will be added often and bew users will be created.
It could be great if I could add droles via API on runtime based on user data. Is it possible? If not, are therea ny other ways to acomplish that?
I think I have found an issue. I get two error messages:
Notice: Array to string conversion in /www/htdocs/w012f278/aki.nogajski.de/wire/core/PageFinder.php on line 1344
Warning: preg_match() expects parameter 2 to be string, array given in /www/htdocs/w012f278/aki.nogajski.de/wire/core/Sanitizer.php on line 328
The line 1344 in PageFinder is: if(!ctype_digit("$parent_id")) {
and a check with var_dump($parent_id)
in line 1343 shows array(2) { [0]=> string(4) "1121" [1]=> string(4) "1014" }
.
And the line 328 in Sanitizer belongs to public function path($value, $maxLength = 1024) {
and $value here is the same Array with the two ids.
I get this with a single dynamic role that I have setup with 2 'has_parent' with OR condition:
template=50|44, has_parent=1121|1014, status=unpublished
Good day!
This super-module seems not to be compatible with 3.x branch. Could it be fixed easily?
As the title suggests. Is this intended behaviour?
Hi, I've come across another issue, but I'm not sure if it's a bug or an intended feature.
Basically I have set up a Dynamic Role purely for guests, but when I add a rule to allow them to view a certain template, they can't. So I'll run through the steps.
I would now expect to see the test page without being logged in, but permission is denied. If however I create a new role, let's say General and assign a member to this role and login, I can see the test page and I assume this is because they also automatically have the guest role.
So the issue seems to be when the person isn't logged in, and is purely a guest.
If this is how it's supposed to work, is there a way we can create a Dynamic Role purely for guests? The reason being, I prefer deal with all the permissions for templates etc on one page like can be done with DR.
Thanks
I have Multiplier installed and added 3 Filter Rules for "what can they view". Now I wanted to add another 4th filter, and upped the setting to allow 4. Now the "Add" button is shown again and I can add a new filter row. But it isn't saved.
Using PW 2.6.18 and latest DynRoles
Since I don't want to set edit/add access on template but using DynRoles, there's no "Add new" functionality possible.
When I add edit/add access on template level I can't use DynRoles to say on which pages they can edit/add pages since we can't ”revoke" access he will also be able to edit or add pages where I don't want to.
It can get complicated to setup things and test. It seems very limited for certain use cases.
I'm not sure what this module is used for or if it's even used anywhere . But currently the drawbacks this module brings (if assuming it's working) defeat its own purpose.
What is the purpose of this module when it doesn't allow me to define "where" to add pages, without giving the role "add chilrdren" access to the parent template? Cause then the user can also add pages in other places which I can't control then. Since it's not revoking access makes this approach very difficult. Or maybe there's bugs or I don't understand how to use it or for what special scenario.
Also as mentioned in other issue. When I'm not setting access on template level, the "Add new" feature isn't working and if I give access on template level there's no use for DynRoles anymore.
That's it really :)
I ran into a problem while testing. I have a role to edit and add pages throughout admin (defined in home template). User with this can add and edit pages fine.
Now if I create a dyn role explicit for ANOTHER role, with some edit and view etc, and only for page with basic-page for example. As soon as this is created the role I mentioned earlier can't add page anymore. The "new" button disappeared. When I delete the dyn role, they reappear.
I don't think this should be the case, as soon as I add a dyn role for a specific role other roles can't add pages anymore.
Both of the hooks to the user class (https://github.com/ryancramerdesign/DynamicRoles/blob/master/DynamicRoleSupport.module#L78-L79) are using $this->wire('user')
instead of $event->object
. While this is probably not a to big a issue in terms of denying access where needed it's still resulting in wrong results for example when calling $page->viewable($user)
for a user other than the current one.
The rebuildForPage method is not being called when a new page is added, which means that the new page won't have the correct permission for the drole.
This fixes it for me (note the addition of !$page->created):
} else if(count($changes) || !$page->created) {
$this->rebuildForPage($page);
}
I did notice something a little weird though - when saving an existing page without changing anything, this method is still being called because the changes array always seems to contain "status" even if I haven't changed the status of the page. Any ideas on this?
I end up with an error after addin->saving the page. Where the page should be created and edited I get:
Error: Call to a member function of() on a non-object (line 665 of /*/wire/core/Page.php)
I'm not sure why this doesn't work. Cross link to issue report on dev ryancramerdesign/ProcessWire#892
I once deleted all users, but recreated them and set the created user id in db to be admin again. But since this is on creating a new page I don't know what's up. Kinda would be great to fix this as I need DynRoles for this project. I'll also try to search.
PW 2.5.19 where you already changed something there, but still get this error.
Hi,
I have come across the following issues with DynamicRoles, and was advised to post them here.
The first one can be found here:
https://processwire.com/talk/topic/6822-module-dynamic-roles-for-pw-246/#entry66809
And the second issue here:
https://processwire.com/talk/topic/6822-module-dynamic-roles-for-pw-246/page-2#entry71501
Thanks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.