Not sure that this was not fixed but I think that roles should also be fieldable entities.
| Comment | File | Size | Author |
|---|---|---|---|
| #12 | role-entity-775734-12.patch | 13.77 KB | claudiu.cristea |
| #10 | role-entity-775734-10.patch | 13.64 KB | claudiu.cristea |
| #7 | role-entity-775734-7.patch | 12.72 KB | claudiu.cristea |
| #5 | role-entity-775734-5.patch | 14.29 KB | claudiu.cristea |
| #4 | role-entity-775734-4.patch | 13.43 KB | claudiu.cristea |
Comments
Comment #1
claudiu.cristeaTagging
Comment #2
SeanBannister commentedUnfortunately setting this to D8 as we're in Code Freeze.
Comment #3
claudiu.cristeaTitle changed.
Comment #4
claudiu.cristeaAnd a first patch.
Comment #5
claudiu.cristeaNew patch with some minor changes.
Comment #7
claudiu.cristeaFixing test failures.
Comment #9
claudiu.cristeaThe test from #7 failed because I have a new class in an .inc file that needs loading with lazy loading but the class is missed from
{registry}table.Tried to add it in
.installwithregistry_rebuild()but it does not show in the table.Comment #10
claudiu.cristeaPrevious tests failed because the test
UserRoleAdminTestCase::testRoleWeightChange()is still keeping the old$roleobject in its static cache. While the test is running in other PHP memory-space,user_role_save()doesn't clear the static cache of the caller PHP space. I changeduser.testso thatuser_role_load()is called now with the "reset cache" flag.Comment #11
claudiu.cristeaTagging
Comment #12
claudiu.cristeaRerolled because of #22336: Move all core Drupal files under a /core folder to improve usability and upgrades.
Comment #13
xjmComment #14
xjmSorry, crosspost. :)
Comment #15
chx commentedI think xjm crossposted on this issue, so that's not relevant here. What this issue needs (in the future) is tests but most of all: reasoning. Why do you think roles should be entities? What are the use cases?
Comment #16
xjmfixing tags
Comment #17
xjmOkay for real. :)
Comment #18
claudiu.cristea@chx,
Reason: Roles should be fieldable too.
Use case? I had a project where I need to attach to each role an image (like a logo) and a description. I had to workaround using other method.
As a possible use case: exposing roles in Views as any entities?
Tests: What specific should we test on a user role entity?
Comment #19
claudiu.cristeaCross posting. Sorry!
Comment #20
chx commentedThis gets tricky -- and i know somewhat frustrating but I am not out to put your work down rather I want to work together towards a better Drupal. Thanks for bearing with me.
That said, is that a valid use case? Didnt you want og for that? What are roles? Arent roles just an implementation of access control? are they really groups?
Comment #21
johnvMy use case for a Role Entity would be for determining Node Access on a Node Edit page.
With Content Access (CA), you have to FIRST: create and save a node, and THEN: remember to go to the Access Control tab.
I prefer something like Access By Term (ABT) does: grant access if both node and user share the same term: user ->term<-node.
Taxonomy Access Control (TAC) does similar, but does not contain the user->term part)
So, the plan is to evaluate ABT to ABR (Access by Entity Reference) . Grant access if both user and node share the same Entity.
Now you can grant access to all documents (content type) for all managers (role) of department HR (a term in vocabulary Departments) , by just setting the Role-field and the Department field in the Node Edit page.
With TAC I would need a 'manager' role for each department; with CA I have an extra tab and ean extra step.
Comment #22
johnvIt would also deprecate:
http://drupal.org/project/role_help
http://drupal.org/project/rolereference , since you would reference a Role via http://drupal.org/project/entityreference
http://drupal.org/project/role_vocabulary
http://drupal.org/project/og_role_field (perhaps, if OG starts leveraging Entity Reference)
Comment #23
Everett Zufelt commentedI just worked on a project using roleReference module. Couldn't you field a vocabulary with roleReference (entity or not) and then use that to evaluate access?
I don't really see a compelling use case for making Role an entity. It seems much more a property of User.
Comment #24
johnvEverett, Entity-fying everything makes all kind of stuff more generic. No separate contribs for term/nodes/user/xyz-references.
I will test the Role reference-field (and the role_vocabulary-module, if necesary).
Comment #25
johnvITMT, I applied patch #12 with D7.9 and Entity API (7.x-1.x-dev d.d. 07-dec-2011). With every cache-refresh I get the following messages 3x:
Both in line 72 of ...\sites\all\modules\entity\entity.module.
Both in line 494 of ...\sites\all\modules\entity\entity.module.
Comment #26
johnvWhen adding a new role, the following error appears:
Fatal error: Class 'UserRoleController' not found in \includes\common.inc on line 7526
BTW. I applied the patch in D7.9. Does it rely on other D8 patches?
Comment #27
sunStandardizing on "entity" tag, which will be renamed to "Entity system".
Comment #28
ParisLiakos commentedAny chance this could get backported to d7?
Comment #29
ParisLiakos commented#12: role-entity-775734-12.patch queued for re-testing.
Comment #31
dagmarMarked #1780122: Add role description and notes as a duplicated of this issue.
Comment #32
hass commented#12: role-entity-775734-12.patch queued for re-testing.
Comment #34
dagmarTagging.
Comment #35
pcambraI'd say this is covered on #1479454: Convert user roles to configurables, duplicated?
Comment #36
claudiu.cristeaYes. This duplicates #1479454: Convert user roles to configurables.
Comment #37
David_Rothstein commentedCorrect me if I'm wrong, but I thought config entities aren't fieldable. That would mean this issue is still valid, right? Presumably this kind of conversion couldn't happen until Drupal 9 though.
Comment #38
claudiu.cristea@David_Rothstein, that means making config entities fieldable. Hm.
Comment #39
xjmUnder our continuous upgrade path and deprecation policy, feature and API additions should be added with backwards compatibility in minor releases, so moving to 8.8.x. Thanks!
Config entities were made not fieldable by choice, FWIW.
Comment #47
anybodyAS of #39 should we perhaps close this won't fix? Or at least postpone it on an issue to make config entities fieldable (if it exists)?
Just came here from #256287: Give roles a description value.