Hi Views maintainers,
I realise one can currently control access to any given display of a view at the permissions or role access levels. I would like to be able to do something similar for display of individual fields within a view result (just as one can with field permissions on page and teaser displays). Perhaps you already know of a way of doing this (in which case this is a support request).
The case is illustrated by the attached image. As part of an engineering glossary system, I have a custom DefinedTerm type, where a DefinedTerm may be defined by one or more "raw" Definitions (another custom type).
In the attached image one can see this for the DefinedTerm 'Tailoring', which has 3 Definitions hits (also with title 'Tailoring', but from different sources), from which different metadata is extracted via views relationships.
Expert users (with 'author' role, representing staff of my client) should have the titled links to the raw Definitions displayed (accessible), whereas mere authenticated (public registered) users should not, they should only ever see the body text of the Definitions displayed "within" a DefinedTerm, without have access to the raw Definition pages.
This is shown in the attached image; the titled links to the Definition nodes are given in pinky red, to indicate these are not intended for the public users.
Very grateful for suggestions,
Webel
PS: thanks for your work on this important module.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | ppi_definitionsbacklinks_field_vf_backlinks_definitions_point.png | 11.46 KB | webel |
| ppi_definition_raw_red.png | 81.28 KB | webel |
Comments
Comment #1
merlinofchaos commentedIf the field is a CCK field, then you can use the field permissions module to restrict fields from users. Of course this is a FULL restriction and applies everywhere, but from your description it sounds like that is what you want.
If you want it only for this view, you can, on the same view, set up multiple page displays with the same path with different access settings. Put the *most* restrictive one first, and the least restrictive one last (i.e, lower in the list of displays). The most restrictive one has the most detail.
Comment #2
webel commented@merlinofchaos
Thanks for prompt reply.
> If the field is a CCK field, then you can use the field permissions module to restrict fields from users.
The CCK field within type Definition referencing DefinedTerm is called
field_defined_term_ref. This is accessed indirectly in the view, which uses a viewfieldfield_vf_backlinks_definitionsto access the many Definitions of a DefinedTerm, and they are formatted by a viewbacklinks_defined_by_definitions.Even when I disable field permission
view field_defined_term_reffor a given role, the title link generated for a Definition is visible to that role, even when that link is correctly not displayed on the node of a Definition (which has a direct reference link to a DefinedTerm).My bold. Thanks, that might do it, I'll report back.
Comment #3
webel commented@merlinofchaos who wrote:
This worked like a charm. I set up 2 differently named Page displays for my view
backlinks_defined_by_definitions:- Page_author ('author' role access), which shows linked title for privileged 'author' role users.
- Page_authenticated ('authenticated' role access), which only shows the Definition node's body and other metadata (but no link to the Definition node).
Both Page displays have identical paths as instructed:
definitions/backlinks)/%When I call directly on the view page by path passing nid as arg, I did get the title nicely filtered out for "mere" authenticated users, just as desired. It is a very powerful feature, thanks for describing it.
However, I have now a secondary issue involving ViewField (nothing to do with Views, however I'll report on a solution here as well, it might help others). My ViewField
field_vf_backlinks_definitionsin my custom type DefinedTerm (representing a technical term that is defined by one or more Definition nodes), has to be pointed at one of the view Page displays. See attached image showing pulldown offering a choice for this view between:No matter which one I choose, it does not seem to pickup the Views role switching trick:
- When I choose display Page_author, "mere" authenticated users can't see the embedded viewfield at all, presumably because it is calling on Page_author and failing access.
- When I choose display Page_authenticated, privileged 'author' role users can't see the extra linked title, presumably because it is calling on Page_authenticated, which of course by design does not show the extra linked title.
I will try some other backlinks modules and report back.
Comment #4
webel commentedThe following only applies to my attempt to embed the display of fields filtered by role for a backlinks case, the solution given by merlinofchaos for simple direct page loads works fine.
I tried using back references from Node Relationships, it did not seem to be able to distinguish between the different Page displays, and it seem to take the default.
I cloned and adapted my multi-Page access restrictive view from above to the correct form for Node Relationships (at least I hope so, cloning and adapting something other than the noderelationships_backref view template is a little error prone). The display served fine, however it did not filter the displayed fields per role.)
The Node Relationships backref user interface pulldown for the view to use does not offer different displays within a view, it seems to be taking the default, and is not catching the Views page-access-by-role trick you described.
Comment #5
webel commentedAgain, only concerning embedding views with fields filtered by role as backlinks
To be sure, I cloned the noderelationships_backref template and reconstructed the different Page displays per access from scratch, to ensure compatibility with Node Relationships. However it does not let me edit the paths, I am getting slightly different paths for the different role-specific Page displays:
In the Views UI the greyed out input field showing the path for each Page is greyed, out, and for Page_author it looks like this:
noderelationships/noderelationships_defined_by_d2/page'The path assigned to this view is dynamically customized by the Node Relationships module.'
However for Page_authenticated it looks like:
noderelationships/noderelationships_defined_by_d2/page-1Note the extra '-1', I can't edit it to make it the same as the path for the other Page_author.
Q1: Why can't I change the paths in the View UI ? Why are they greyed out ?
Not sure whether this has to do with Views or Node Relationships:
Q2: Do you know how I can override the view cloned from noderelationships_backref so that the Page paths are editable, so I can ensure the are identical (so that the Page access trick works).
Grateful for suggestions.
Comment #6
webel commentedReactivated as support request (although original feature request met for basic cases wonderfully, however not met when combined with backlinks modules, not Views fault, however maybe you have the answer).
In the view cloned from noderelationships_backref (and adapted to introduce role-specific Page displays) I examined the View settings and found:
Do you merlinofchaos (or markus_petrux of Node Relationships) know whether there is some special behind-the-scenes feature that is likewise making the path readonly (which is thwarting implementation of the nice Views trick you described for choosing between role-specific Page displays with identical path).
Comment #7
webel commentedxref to Node Relationships:
#767910: Integration of (cloned and adapted) noderelationships_backref view with per-role Page displays (sharing identical path) in View
Comment #8
webel commentedHaving same trouble exploiting the per-role Page access trick with View Reference that I had with Viewfield. I seem to have to choose between one role-specific Page display or another, I can't "have me cake and eat it" relying on identical paths.
Comment #9
merlinofchaos commentedI don't know anything about that message you're seeing, unfortunately, so I don't know why you can't edit the path.
Comment #10
webel commented@merlinofchaos
Could you please examine this view export to see whether any setting there would prevent me from editing the paths ? If not, then it seems Node Relationships is intercepting something somewhere. I've snipped some irrelevant field stuff:
If you can't see anything suspicious I'll seek support as a Node Relationships issue: #767910: Integration of (cloned and adapted) noderelationships_backref view with per-role Page displays (sharing identical path) in View.
Please keep this open, I want report back here on which combination of Views + "a backlinks module" can be used successfully in combination with the Views page access "trick" when Page displays have identical path.
Comment #11
webel commentedAs far as I can tell, Node Relationships backref facility is always going to call the default view display anyway, not an access-specific Page (no matter what path):
http://drupal.org/node/767910#comment-2834422
So I don't think I can combine the strategy you suggest (known to work directly) with backlinks views using Node Relationships.
Comment #12
webel commentedI've found where Node Relationships is overriding the view Page display paths.
http://drupal.org/node/767910#comment-2834412
Comment #13
merlinofchaos commentedSo, should this issue move to that module? Doesn't seem like much I can do about it.
Comment #14
webel commented@merlinofchaos
> So, should this issue move to that module?
Although there is little that can be done involving Views, please don't move this support request from the Views issues area, because it is about the interaction of at least 3 other formatted-backlinks-capable modules (Viewfield, View Reference, Node Relationships) with a (functioning) Views feature. I will open dedicated support/feature requests for each of those modules, and once I have a solution known to combine well with the Views feature, I would like to report it back here briefly for Views users. The ability to filter displayed fields by role is just as important for richly formatted backlinks as for regular views, and hopefully of interest to other Views users.
> Doesn't seem like much I can do about it.
No, nothing you can do, please just let it hang here though. Thanks for your input.
Comment #15
webel commentedComment #16
WorldFallz commentedSince there's nothing views can do about this, closing. If you solve the problem with the other modules feel free to update with the resolution but in light of the fact 1) we're cleaning up the views issue queue and 2) there's nothing that views can do about this it really does need to be closed.
Comment #17
sadam 001 commentedhow to hiden edit colum in drupal
Comment #18
sadam 001 commentedi create to view page and create to some columns
ex: title , body , image , edit, delete
i want hidden edit column to display in user side.