There is no mechanism in ACL module that allows other modules to define finer-granularity access to nodes (such as access to node's individual cck fields). It would be nice to have this feature so there is no need for yet another ACL-type module besides ACL.

CommentFileSizeAuthor
#1 acl_node_data.1305678-1.patch2.38 KBiva2k

Comments

iva2k’s picture

Status: Active » Needs review
StatusFileSize
new2.38 KB

Attached is a patch that provides generic data field in acl_node table. All changes are transparent to all existing modules.

iva2k’s picture

Title: Data field in acl_node table » Data field in acl_node table - allow defining access with finer granularity when needed
salvis’s picture

There's a core mechanism to do that: hook_schema_alter(). It lets you change the schema of every table in your database. Serialized varchar may work for your requirements, but others might need two ints or unserialized varchar (so that they can index and search on that column, too).

I think implementing hook_schema_alter() in your module is the better approach, rather than adding something "generic" to ACL that caters only to a small percentage of users.

Hint: Be sure to make the additional column optional!

iva2k’s picture

Thanks for quick response. I will ponder on hook_schema_alter(), though data column seems more natural to me.

What if I remove serialize/unserialize but keep the varchar, will you commit the feature? That will allow other modules to have more flexibility. For cases like two ints they can store as a formatted string and still perform search if needed (can use > or < on strings too). This column's purpose is not to provide searches, so it is not indexed anyway, it is just to provide ways for storing arbitrary details. For instance, there are no calls in current API to search ACLs on grant_view/delete/update columns.

salvis’s picture

Status: Needs review » Closed (won't fix)

hook_schema_alter() is data column, customized to your exact needs, without bothering anyone else who may have different needs, or, more likely, no use for an additional column at all. Your only inconvenience is having to write your own version of acl_node_add_acl().

This is not a generally useful feature but a specific customization for your site. Enabling such customizations is the reason for having hooks like hook_schema_alter().

So, no, I won't commit this, sorry.

salvis’s picture

Issue summary: View changes

minor edit