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

Comments

dawehner’s picture

Status: Active » Fixed

I 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.

MStrzelecki_’s picture

I 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

MStrzelecki_’s picture

Status: Fixed » Postponed (maintainer needs more info)
StatusFileSize
new1.05 KB

I have started to work on this, but my custom handler even do not want to display in views options ;/
What am I doing wrong?

MStrzelecki_’s picture

StatusFileSize
new1.96 KB

updated, but it doesn't appear in view's menu ;/

dawehner’s picture

You 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"

MStrzelecki_’s picture

StatusFileSize
new1.68 KB

i dont know what to do next.

MStrzelecki_’s picture

StatusFileSize
new2.14 KB

update

If I would have enough time I will try to deploy this tomorrow.

MStrzelecki_’s picture

StatusFileSize
new111.42 KB
new11.89 KB

Hi!

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

MStrzelecki_’s picture

Category: support » bug
Status: Postponed (maintainer needs more info) » Active
dawehner’s picture

Status: Active » Fixed

The 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.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.