Hi!
I am trying to list nodes in first column and roles that have access to them in the second column. When I add a field 'roles' it doesn't show any roles that have access to node.
I am using acl + content access for per node access control.
How can I accomplish this?
I do not know where to put this topic... To support or feature request?
regards,
Mike
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | user and perm view list.txt | 11.89 KB | MStrzelecki_ |
| #8 | user and perm view list - error.txt | 111.42 KB | MStrzelecki_ |
| #7 | views_content_access.zip | 2.14 KB | MStrzelecki_ |
| #6 | views_content_access.zip | 1.68 KB | MStrzelecki_ |
| #4 | views_content_access.zip | 1.96 KB | MStrzelecki_ |
Comments
Comment #1
dawehnerI think it's impossible to implement this as a generic solution because node access might be per user, so displaying
the role which has access is actually wrong. If you have configured content access + acl in such a way the proper solution is to write some kind of custom field handlers to fetch you this data.
Read help/api.html and help/api-tables.html to read the basic stuff of the views api.
Comment #2
MStrzelecki_ commentedI have started another thread here http://drupal.org/node/1319732. I think salvis has right. Devel Node Access is a pretty good stuff, so why we can't use its code? Or maybe think about patch?
http://drupal.org/node/1320782
regards,
Mike
Comment #3
MStrzelecki_ commentedI have started to work on this, but my custom handler even do not want to display in views options ;/
What am I doing wrong?
Comment #4
MStrzelecki_ commentedupdated, but it doesn't appear in view's menu ;/
Comment #5
dawehnerYou don't have to implement hook_views_handlers, but adding the custom class to a file and add it to your info file via "files[] = filename"
Comment #6
MStrzelecki_ commentedi dont know what to do next.
Comment #7
MStrzelecki_ commentedupdate
If I would have enough time I will try to deploy this tomorrow.
Comment #8
MStrzelecki_ commentedHi!
I have add a User: Permission field to my view (I attached it to this post).
Previously I uninstall my earlry stage development module and clear cache twice.
I have this long error (also as attachment to this view)
Notice: Undefined index: create article content w views_handler_field_user_permissions->pre_render() (linia 40 z D:\xampplite\htdocs\serwis_dokumentow\sites\all\modules\views\modules\user\views_handler_field_user_permissions.inc).
using only veiws'es core User: Permission field. Maybe I should not deploy this modul? As it can work nativly in views becouse content access implements hook_permission().
This code
if ($uids) {
// Get a list of all the modules implementing a hook_permission() and sort by
// display name.
$module_info = system_get_info('module');
$modules = array();
foreach (module_implements('permission') as $module) {
$modules[$module] = $module_info[$module]['name'];
}
asort($modules);
$permissions = module_invoke_all('permission');
$result = db_query("SELECT u.uid, u.rid, rp.permission FROM {role_permission} rp INNER JOIN {users_roles} u ON u.rid = rp.rid WHERE u.uid IN (:uids) AND rp.module IN (:modules) ORDER BY rp.permission",
array(':uids' => $uids, ':modules' => array_keys($modules)));
foreach ($result as $perm) {
$this->items[$perm->uid][$perm->permission]['permission'] = $permissions[$perm->permission]['title'];
}
from views_handler_field_user_permissions.inc tells me that it should list also permissions from other modules which implement hook_permission().
Am I wrong?
It would be helpfull not only for me if it would works.
regards,
Mike
Comment #9
MStrzelecki_ commentedComment #10
dawehnerThe imported view works fine, so i guess something is broken on your site.
As there is no feedback since quite some time i guess you have figured it out in the meantime.