Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
In reference to this post -> https://www.drupal.org/node/1374150
node-like permissions to custom entities? e.g. "view own", "edit own", "delete own", "view all", etc. Is it possible? What is the best approach to go about building it?
Comments
Comment #1
kristianb21 CreditAttribution: kristianb21 commentedComment #2
fmizzell CreditAttribution: fmizzell commentedComment #3
Yuri CreditAttribution: Yuri commentedComment #4
longwaveThis is doable with a bit of custom code, adapt as needed - in my case I didn't care about specific permissions, just entity ownership:
Comment #5
kingandy CreditAttribution: kingandy commentedWeirdly, ECK seems to halfway offer 'own' management functionality. When the $b_own argument for eck__multiple_access_check() is set to TRUE, for each permission in the passed-in array, it also checks for one with the same name appended with " own". So for example, if a menu callback was checking for "eck administer my_type my_bundle entities" and "eck edit my_type my_bundle entities", it would also check "eck administer my_type my_bundle entities own" and "eck edit my_type my_bundle entities own".
But, ECK itself doesn't actually declare those '... own' permissions in hook_permission, and I've not found anywhere that actually uses
$b_own = TRUE
, so I guess it never got fully implemented (or is a vestige of an earlier 'own' permission model).