Closed (outdated)
Project:
ACL
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
7 Apr 2010 at 09:46 UTC
Updated:
18 Feb 2021 at 16:11 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
salvisI don't think this is a good idea. It returns the acl_ids of all modules to the caller, and the caller should never touch ACL records that aren't his own.
Do you need this for anything besides acl_node_clear_acls($nid, $module)? acl_node_clear_acls($nid, $module), BTW, does it the right way, by restricting the query to $modules.
Comment #2
nick_vhOk, you are right about the restricting of the module.
I personally need this function because I have dynamic naming of my ACL's and I do not always know which ACL's are attached to my module (atleast not by name) and I want to know if an ACL is attached to this node and also to an other without knowing the name.
Anyway, here is the updated patch
Comment #3
nick_vhChanged the conditions of the query to restrict to the module.
The query got a little bit more complicated but I think it's fine
Also got it through coder and does not report any problem.
Comment #4
salvisWe typically don't use the optional "AS" keyword in SQL. If we did, it would have to be in upper case, but I prefer to not have it at all.
The code looks ok otherwise, but I don't have the time to write a test (module or simpletest) for this new function. Would this be the right occasion to start the series of simpletests for ACL (see #761696: WANTED: SimpleTests for ACL)?
Comment #5
nick_vhSo here we are without the 'as' keyword.
Comment #6
miro_dietikerAt least the alias n is typically used for node table only. Use something like na or an.
Also i don't like the notation of your join. Please use a regular INNER or LEFT JOIN syntax with ON condition about the relationship. This makes it much more readable.
Also i think we should return an empty array in case of emptyness. mixing arrays and non-arrays leads to huge problems with array functions and needs pre-checks here and there.
Comment #7
nick_vhIn attachment the adjusted patch.
I did not change the return type since an other function also uses the same syntax (acl_get_uids) so the maintainer should make a decision if an empty array is better then a NULL value.
Hopefully good enough for the final review ;-)
Comment #8
salvisHmm, I agree with Miro about the aliases, but renaming acl_id to gid does not improve clarity. Maybe you took this from acl_node_access_records(), where the key needs to be 'gid' for an external reason.
What? We already have an empty array. Why can't we just return $return?
The last paragraph in #4 still applies...
Comment #9
yellek commented+1, I need this for a module I'm writing to copy ACLs between nodes (i.e. Referencing multiple nodes to the same ACL).
Comment #10
salvis