Different view filter depending on role
Deplifer helped to make this snippet (http://drupal.org/node/162567). Thank you very much, deplifer!
By default one can't apply different filter to view depending on the viewer's role. So, using your code in Views PHP Filter module, you can do it. Now the output of the view depends on the user's role.
To show ALL nodes of the certain type to administrator roles, and to show ONLY user's own nodes to all other roles, you need to use Views PHP Filter module. Install it, then create the usual view, enable "Node: Node ID" filter, with operator "Is One Of", and following value:
global $user;
$type = 'page';
$allowed = array('Administrator','Editor');
foreach($user->roles as $role){
if(in_array($role, $allowed)) {
$nids = db_result(db_query("SELECT GROUP_CONCAT(nid) FROM node WHERE type = '%s'", $type));
} else {
$uid=$user->uid;
$nids = db_result(db_query("SELECT GROUP_CONCAT(nid) FROM node WHERE type = '%s' AND uid = %d", $type, $uid));
}
}
return $nids;This might be not very clean code (I don't know PHP, I just played with snippets from this site), but anyway it is working and useful. You can use it, for example, with node reference field from cck module (it can be configured on the field setting page). Now non-administrators will be able to reference to their own nodes only, while administrators - to any node.

Views PHP Filter Module?
Can someone please provide a link to the "Views PHP Filter Module" describe above. Does it exist for Drupal 5.x?
...found it! It's here: http://drupal.org/project/viewsphpfilter