Difference between revisions of "User roles.pl"

From EPrints Documentation
Jump to: navigation, search
Line 31: Line 31:
 
</pre>
 
</pre>
  
 
+
Rather than giving every user the role
  
 
my $PRIVMAP =  
 
my $PRIVMAP =  

Revision as of 09:26, 20 October 2010

User roles control various aspects of what a user can do in eprints. By default there are 4 categories of user: Administrator, Editor, User, and minimal User. user_roles.pl controls what each class of user can do. You can also make you own classes of user in this file.

A role in EPrints is made up of 1 or more privilages. Giving a user a role gives them all the priviliges associated with that role. You can also give users additional priviliages without giving them the full role.

Creating a role

To create the role approve-hat you would do the following:

$c->{roles}->{"approve-hat"} = [
       "eprint/buffer/view:editor",
       "eprint/buffer/summary:editor",
       "eprint/buffer/details:editor",
       "eprint/buffer/move_archive:editor",
];

The prviliages listed above means the users given the approve-hat role can see the View, Summary, Details and Move to archive screen as an editor. Note because they cannot edit items in the buffer they can't correct any mistakes they find. How ever they do have the power to move items to the archive. This means the approve-hat allows a user to see the metadata of an item and if they think it is correct move it to the archive. They cannot return it to the user or edit the metadata themselves.

Assigning a role

Now that you have created a role you want to give that to class of users. To give every regular user of the repository the approve-hat you add it to the list of roles for the user.

$c->{user_roles}->{user} = [
        'general',
        'edit-own-record',
        'saved-searches',
        'set-password',
        'deposit',
        'change-email',
        'approve-hat',
],

Rather than giving every user the role

my $PRIVMAP = {

general => [ "user/view", ],

"edit-own-record" => [ "user/edit:owner", ],

"set-password" => [ "set-password", ],

"change-email" => [ # not done ],

"change-user" => [ # not done ],

"staff-view" => [ # still needs search tools

"eprint/inbox/view", "eprint/inbox/summary", "eprint/inbox/staff/export", "eprint/inbox/staff/details", "eprint/inbox/history",

"eprint/buffer/view", "eprint/buffer/summary", "eprint/buffer/staff/export", "eprint/buffer/staff/details", "eprint/buffer/history",

"eprint/archive/view", "eprint/archive/summary", "eprint/archive/staff/export", "eprint/archive/staff/details", "eprint/archive/history",

"eprint/deletion/view", "eprint/deletion/summary", "eprint/deletion/staff/export", "eprint/deletion/staff/details", "eprint/deletion/history",

"staff/eprint_search", ],

"view-status" => [ "status" ],

"admin" => [ "indexer/stop", "indexer/start", "indexer/force_start", "user/remove:editor", "user/view:editor", "user/history:editor", "user/staff/edit:editor", "create_user", "subject/edit:editor", "staff/user_search", "staff/history_search", "staff/issue_search", "config/view", "config/view/xml", "config/view/workflow", "config/view/citation", "config/view/phrase", "config/view/namedset", "config/view/template", "config/view/static", "config/view/autocomplete", "config/view/apache", "config/view/perl", "config/test_email", "config/add_field", "config/remove_field", "config/regen_abstracts", "config/regen_views", "metafield/view", "metafield/edit", ],

"toolbox" => [ "toolbox", ],

"edit-config" => [ "config/edit", "config/edit/xml", "config/edit/workflow", "config/edit/citation", "config/edit/phrase", "config/edit/namedset", "config/edit/template", "config/edit/static", "config/edit/autocomplete", # not editing perl files or apache files! "config/reload", ],

"saved-searches" => [ "saved_search", "create_saved_search", "saved_search/view:owner", "saved_search/perform:owner", "saved_search/edit:owner", "saved_search/remove:owner", ],

deposit => [ "items", "create_eprint", "user/history:owner",

"eprint/inbox/view:owner", "eprint/inbox/summary:owner", "eprint/inbox/deposit:owner", "eprint/inbox/edit:owner", "eprint/inbox/remove:owner", "eprint/inbox/export:owner", "eprint/inbox/details:owner", "eprint/inbox/history:owner", "eprint/inbox/messages:owner", "eprint/inbox/issues:owner",

"eprint/inbox/deposit:owner", "eprint/inbox/use_as_template:owner", "eprint/inbox/derive_version:owner",


"eprint/buffer/view:owner", "eprint/buffer/summary:owner", "eprint/buffer/move_inbox:owner", "eprint/buffer/export:owner", "eprint/buffer/details:owner", "eprint/buffer/history:owner", "eprint/buffer/messages:owner",

"eprint/buffer/request_removal:owner", "eprint/buffer/use_as_template:owner", "eprint/buffer/derive_version:owner",


"eprint/archive/view:owner", "eprint/archive/summary:owner", "eprint/archive/export:owner", "eprint/archive/details:owner", "eprint/archive/history:owner", "eprint/archive/messages:owner",

"eprint/archive/request_removal:owner", "eprint/archive/use_as_template:owner", "eprint/archive/derive_version:owner",


"eprint/deletion/view:owner", "eprint/deletion/summary:owner", "eprint/deletion/export:owner", "eprint/deletion/details:owner", "eprint/deletion/history:owner", "eprint/deletion/messages:owner",

"eprint/deletion/use_as_template:owner", "eprint/deletion/derive_version:owner", ],

editor => [ "editorial_review",

"eprint/inbox/view:editor", "eprint/inbox/summary:editor", "eprint/inbox/staff/export:editor", "eprint/inbox/staff/details:editor", "eprint/inbox/history:editor", "eprint/inbox/messages:editor",

"eprint/inbox/remove_with_email:editor", "eprint/inbox/move_archive:editor", "eprint/inbox/move_buffer:editor", "eprint/inbox/use_as_template:editor", "eprint/inbox/derive_version:editor", "eprint/inbox/staff/edit:editor",


"eprint/buffer/view:editor", "eprint/buffer/summary:editor", "eprint/buffer/staff/export:editor", "eprint/buffer/staff/details:editor", "eprint/buffer/history:editor", "eprint/buffer/messages:editor", "eprint/buffer/issues:editor",

"eprint/buffer/remove_with_email:editor", "eprint/buffer/reject_with_email:editor", "eprint/buffer/move_inbox:editor", "eprint/buffer/move_archive:editor", "eprint/buffer/use_as_template:editor", "eprint/buffer/derive_version:editor", "eprint/buffer/staff/edit:editor",


"eprint/archive/view:editor", "eprint/archive/summary:editor", "eprint/archive/staff/export:editor", "eprint/archive/staff/details:editor", "eprint/archive/history:editor", "eprint/archive/messages:editor", "eprint/archive/issues:editor",

"eprint/archive/move_buffer:editor", "eprint/archive/move_deletion:editor", "eprint/archive/use_as_template:editor", "eprint/archive/derive_version:editor", "eprint/archive/staff/edit:editor",


"eprint/deletion/view:editor", "eprint/deletion/summary:editor", "eprint/deletion/staff/export:editor", "eprint/deletion/staff/details:editor", "eprint/deletion/history:editor", "eprint/deletion/messages:editor",

"eprint/deletion/move_archive:editor", "eprint/deletion/use_as_template:editor", "eprint/deletion/derive_version:editor", ],

};