Difference between revisions of "User roles.pl"

From EPrints Documentation
Jump to: navigation, search
(Listing link typo)
 
(15 intermediate revisions by 4 users not shown)
Line 1: Line 1:
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.
+
{{dirs}}
 +
{{cfgd}}
  
A role in EPrints is made up of 1 or more privileges. Giving a user a role gives them all the privileges associated with that role. You can also give users additional privileges without giving them the full role.  
+
'''user_roles.pl''' controls 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 your own classes of user in this file.
  
==Creating a role==
+
This is a full list of privileges defined in EPrints 3.3.15. They are just strings so you create your own when you create a role in user roles.pl
 
 
To create the role <code>approve-hat</code> you would do the following:
 
<pre>
 
$c->{roles}->{"approve-hat"} = [
 
      "eprint/buffer/view:editor",
 
      "eprint/buffer/summary:editor",
 
      "eprint/buffer/details:editor",
 
      "eprint/buffer/move_archive:editor",
 
];
 
</pre>
 
The prviliages listed above means the users given the <code>approve-hat</code> 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 <code>approve-hat</code> 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 <code>approve-hat</code> you add it to the list of roles for the user.
 
 
 
<pre>
 
$c->{user_roles}->{user} = [
 
        'general',
 
        'edit-own-record',
 
        'saved-searches',
 
        'set-password',
 
        'deposit',
 
        'change-email',
 
        'approve-hat',
 
],
 
</pre>
 
 
 
Rather than giving every user the role you can give it to individual users. Administer a users profile and add the name of the role to their list of additional roles.
 
 
 
==Assigning a user privilege==
 
You do not have to give a user a full role you can give them a privilege. The syntax is slightly different. Add the name of the privilege prefixed with a '+' to the list of roles. You can remove a privilege by prefixing it with a '-'.
 
 
 
<pre>
 
$c->{user_roles}->{user} = [
 
        'general',
 
        'edit-own-record',
 
        'saved-searches',
 
        'set-password',
 
        'deposit',
 
        'change-email',
 
        'approve-hat',
 
        '+eprint/archive/edit:owner',
 
],
 
</pre>
 
 
 
You can also assign privileges to individual users through the web interface in the same way you can assign a role. (remember the '+' or '-')
 
 
 
 
 
 
 
==List of Roles and privileges==
 
This is a full list of privileges defined in EPrints 3.1.3. They are just strings so you create your own when you create a role in user roles.pl
 
  
 
<pre>
 
<pre>
Line 61: Line 11:
 
general =>  
 
general =>  
 
[
 
[
"user/view",
+
"user/view:owner",
 +
"user/details:owner",
 +
"user/history:owner",
 
],
 
],
  
Line 90: Line 42:
 
"eprint/inbox/view",
 
"eprint/inbox/view",
 
"eprint/inbox/summary",
 
"eprint/inbox/summary",
"eprint/inbox/staff/export",
+
"eprint/inbox/export",
"eprint/inbox/staff/details",
+
"eprint/inbox/details",
 
"eprint/inbox/history",
 
"eprint/inbox/history",
  
 
"eprint/buffer/view",
 
"eprint/buffer/view",
 
"eprint/buffer/summary",
 
"eprint/buffer/summary",
"eprint/buffer/staff/export",
+
"eprint/buffer/export",
"eprint/buffer/staff/details",
+
"eprint/buffer/details",
 
"eprint/buffer/history",
 
"eprint/buffer/history",
  
 
"eprint/archive/view",
 
"eprint/archive/view",
"eprint/archive/summary",
+
"eprint/archive/export",
"eprint/archive/staff/export",
+
"eprint/archive/details",
"eprint/archive/staff/details",
 
 
"eprint/archive/history",
 
"eprint/archive/history",
  
 
"eprint/deletion/view",
 
"eprint/deletion/view",
 
"eprint/deletion/summary",
 
"eprint/deletion/summary",
"eprint/deletion/staff/export",
+
"eprint/deletion/export",
"eprint/deletion/staff/details",
+
"eprint/deletion/details",
 
"eprint/deletion/history",
 
"eprint/deletion/history",
  
"staff/eprint_search",
+
"eprint/search/staff",
 
],
 
],
 
 
Line 125: Line 76:
 
"indexer/start",
 
"indexer/start",
 
"indexer/force_start",
 
"indexer/force_start",
"user/remove:editor",
 
"user/view:editor",
 
"user/history:editor",
 
"user/staff/edit:editor",
 
 
"create_user",
 
"create_user",
"subject/edit:editor",
+
"subject/edit",
 
"staff/user_search",
 
"staff/user_search",
 
"staff/history_search",
 
"staff/history_search",
Line 146: Line 93:
 
"config/view/perl",
 
"config/view/perl",
 
"config/test_email",
 
"config/test_email",
 +
"config/imports",
 
"config/add_field",
 
"config/add_field",
 
"config/remove_field",
 
"config/remove_field",
 
"config/regen_abstracts",
 
"config/regen_abstracts",
 
"config/regen_views",
 
"config/regen_views",
"metafield/view",
+
"config/edit/perl",
"metafield/edit",
+
 
 +
"storage/manager",
 +
"repository/epm", #EPrints Package Manager
 +
 
 +
"event_queue/destroy",
 +
"event_queue/details",
 +
"event_queue/edit",
 +
"event_queue/export",
 +
"event_queue/view",
 +
"eprint/destroy",
 +
"eprint/details",
 +
"eprint/edit",
 +
"eprint/export",
 +
"eprint/upsert",
 +
"eprint/view",
 +
"eprint/archive/remove",
 +
"eprint/archive/edit", # BatchEdit
 +
"file/destroy",
 +
"file/export",
 +
"file/view",
 +
"import/view",
 +
"import/edit",
 +
"saved_search/destroy",
 +
"saved_search/details",
 +
"saved_search/edit",
 +
"saved_search/export",
 +
"saved_search/view",
 +
"user/remove",
 +
"user/edit",
 +
"user/view",
 +
"user/details",
 +
"user/destroy",
 +
"user/history",
 +
"user/staff/edit",
 +
"repository/epm-submit", #EPrints Package Manager - Bazaar Package Submission
 
],
 
],
  
Line 179: Line 161:
 
"create_saved_search",
 
"create_saved_search",
 
"saved_search/view:owner",
 
"saved_search/view:owner",
"saved_search/perform:owner",
 
 
"saved_search/edit:owner",
 
"saved_search/edit:owner",
"saved_search/remove:owner",
+
"saved_search/destroy:owner",
 
],
 
],
  
Line 191: Line 172:
 
 
 
"eprint/inbox/view:owner",
 
"eprint/inbox/view:owner",
 +
"eprint/inbox/export:owner",
 
"eprint/inbox/summary:owner",
 
"eprint/inbox/summary:owner",
 +
"eprint/inbox/destroy:owner",
 
"eprint/inbox/deposit:owner",
 
"eprint/inbox/deposit:owner",
 
"eprint/inbox/edit:owner",
 
"eprint/inbox/edit:owner",
 
"eprint/inbox/remove:owner",
 
"eprint/inbox/remove:owner",
"eprint/inbox/export:owner",
 
 
"eprint/inbox/details:owner",
 
"eprint/inbox/details:owner",
 
"eprint/inbox/history:owner",
 
"eprint/inbox/history:owner",
Line 207: Line 189:
 
 
 
"eprint/buffer/view:owner",
 
"eprint/buffer/view:owner",
 +
"eprint/buffer/export:owner",
 
"eprint/buffer/summary:owner",
 
"eprint/buffer/summary:owner",
 
"eprint/buffer/move_inbox:owner",
 
"eprint/buffer/move_inbox:owner",
"eprint/buffer/export:owner",
 
 
"eprint/buffer/details:owner",
 
"eprint/buffer/details:owner",
 
"eprint/buffer/history:owner",
 
"eprint/buffer/history:owner",
Line 220: Line 202:
 
 
 
"eprint/archive/view:owner",
 
"eprint/archive/view:owner",
 +
"eprint/archive/export:owner",
 
"eprint/archive/summary:owner",
 
"eprint/archive/summary:owner",
"eprint/archive/export:owner",
 
 
"eprint/archive/details:owner",
 
"eprint/archive/details:owner",
 
"eprint/archive/history:owner",
 
"eprint/archive/history:owner",
Line 232: Line 214:
  
 
"eprint/deletion/view:owner",
 
"eprint/deletion/view:owner",
 +
"eprint/deletion/export:owner",
 
"eprint/deletion/summary:owner",
 
"eprint/deletion/summary:owner",
"eprint/deletion/export:owner",
 
 
"eprint/deletion/details:owner",
 
"eprint/deletion/details:owner",
 
"eprint/deletion/history:owner",
 
"eprint/deletion/history:owner",
Line 244: Line 226:
 
editor =>  
 
editor =>  
 
[
 
[
 +
"datasets",
 +
 
"editorial_review",
 
"editorial_review",
  
 
"eprint/inbox/view:editor",
 
"eprint/inbox/view:editor",
 +
"eprint/inbox/export:editor",
 
"eprint/inbox/summary:editor",
 
"eprint/inbox/summary:editor",
"eprint/inbox/staff/export:editor",
+
"eprint/inbox/export:editor",
"eprint/inbox/staff/details:editor",
+
"eprint/inbox/details:editor",
 
"eprint/inbox/history:editor",
 
"eprint/inbox/history:editor",
 
"eprint/inbox/messages:editor",
 
"eprint/inbox/messages:editor",
Line 258: Line 243:
 
"eprint/inbox/use_as_template:editor",
 
"eprint/inbox/use_as_template:editor",
 
"eprint/inbox/derive_version:editor",
 
"eprint/inbox/derive_version:editor",
"eprint/inbox/staff/edit:editor",
+
"eprint/inbox/edit:editor",
 +
"eprint/inbox/takelock:editor",
  
  
 
"eprint/buffer/view:editor",
 
"eprint/buffer/view:editor",
 +
"eprint/buffer/export:editor",
 
"eprint/buffer/summary:editor",
 
"eprint/buffer/summary:editor",
"eprint/buffer/staff/export:editor",
+
"eprint/buffer/export:editor",
"eprint/buffer/staff/details:editor",
+
"eprint/buffer/details:editor",
 
"eprint/buffer/history:editor",
 
"eprint/buffer/history:editor",
 
"eprint/buffer/messages:editor",
 
"eprint/buffer/messages:editor",
Line 275: Line 262:
 
"eprint/buffer/use_as_template:editor",
 
"eprint/buffer/use_as_template:editor",
 
"eprint/buffer/derive_version:editor",
 
"eprint/buffer/derive_version:editor",
"eprint/buffer/staff/edit:editor",
+
"eprint/buffer/edit:editor",
 +
"eprint/buffer/takelock:editor",
  
  
 
"eprint/archive/view:editor",
 
"eprint/archive/view:editor",
"eprint/archive/summary:editor",
+
"eprint/archive/export:editor",
"eprint/archive/staff/export:editor",
+
"eprint/archive/details:editor",
"eprint/archive/staff/details:editor",
 
 
"eprint/archive/history:editor",
 
"eprint/archive/history:editor",
 
"eprint/archive/messages:editor",
 
"eprint/archive/messages:editor",
Line 290: Line 277:
 
"eprint/archive/use_as_template:editor",
 
"eprint/archive/use_as_template:editor",
 
"eprint/archive/derive_version:editor",
 
"eprint/archive/derive_version:editor",
"eprint/archive/staff/edit:editor",
+
"eprint/archive/edit:editor",
 +
"eprint/archive/takelock:editor",
  
  
 
"eprint/deletion/view:editor",
 
"eprint/deletion/view:editor",
 +
"eprint/deletion/export:editor",
 
"eprint/deletion/summary:editor",
 
"eprint/deletion/summary:editor",
"eprint/deletion/staff/export:editor",
+
"eprint/deletion/export:editor",
"eprint/deletion/staff/details:editor",
+
"eprint/deletion/details:editor",
 
"eprint/deletion/history:editor",
 
"eprint/deletion/history:editor",
 
"eprint/deletion/messages:editor",
 
"eprint/deletion/messages:editor",
Line 303: Line 292:
 
"eprint/deletion/use_as_template:editor",
 
"eprint/deletion/use_as_template:editor",
 
"eprint/deletion/derive_version:editor",
 
"eprint/deletion/derive_version:editor",
 +
"eprint/deletion/takelock:editor",
 +
],
 +
 +
rest => [
 +
"eprint/archive/rest/get:editor",
 +
"eprint/archive/rest/put:editor",
 +
"eprint/buffer/rest/get:editor",
 +
"eprint/buffer/rest/put:editor",
 +
"eprint/inbox/rest/get:editor",
 +
"eprint/inbox/rest/put:editor",
 +
"eprint/deletion/rest/get:editor",
 +
"eprint/deletion/rest/put:editor",
 +
 +
"eprint/inbox/rest/get:owner",
 +
"eprint/inbox/rest/put:owner",
 +
"eprint/buffer/rest/get:owner",
 +
"eprint/archive/rest/get:owner",
 +
"eprint/deletion/rest/get:owner",
 +
 +
"user/rest/get:owner",
 +
 +
"subject/rest/get",
 
],
 
],
 
 
 
};
 
};
 +
 
</pre>
 
</pre>
 +
 +
== See Also ==
 +
* [[User Roles and Privileges]]
 +
* [[Listings of User Roles and Privileges]]

Latest revision as of 16:26, 30 August 2022

EPrints 3 Reference: Directory Structure - Metadata Fields - Repository Configuration - XML Config Files - XML Export Format - EPrints data structure - Core API - Data Objects


Back to cfg.d

user_roles.pl controls 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 your own classes of user in this file.

This is a full list of privileges defined in EPrints 3.3.15. They are just strings so you create your own when you create a role in user roles.pl

{

	general => 
	[
		"user/view:owner",
		"user/details:owner",
		"user/history:owner",
	],

	"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/export",
		"eprint/inbox/details",
		"eprint/inbox/history",

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

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

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

		"eprint/search/staff",
	],
	
	"view-status" => 
	[
		"status"
	],

	"admin" =>
	[
		"indexer/stop",
		"indexer/start",
		"indexer/force_start",
		"create_user",
		"subject/edit",
		"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/imports",
		"config/add_field",
		"config/remove_field",
		"config/regen_abstracts",
		"config/regen_views",
		"config/edit/perl",

		"storage/manager",
		"repository/epm", #EPrints Package Manager

		"event_queue/destroy",
		"event_queue/details",
		"event_queue/edit",
		"event_queue/export",
		"event_queue/view",
		"eprint/destroy",
		"eprint/details",
		"eprint/edit",
		"eprint/export",
		"eprint/upsert",
		"eprint/view",
		"eprint/archive/remove",
		"eprint/archive/edit", # BatchEdit
		"file/destroy",
		"file/export",
		"file/view",
		"import/view",
		"import/edit",
		"saved_search/destroy",
		"saved_search/details",
		"saved_search/edit",
		"saved_search/export",
		"saved_search/view",
		"user/remove",
		"user/edit",
		"user/view",
		"user/details",
		"user/destroy",
		"user/history",
		"user/staff/edit",
		"repository/epm-submit", #EPrints Package Manager - Bazaar Package Submission
	],

	"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/edit:owner",
		"saved_search/destroy:owner",
	],

	deposit => 
	[
		"items",
		"create_eprint",
		"user/history:owner",
	
		"eprint/inbox/view:owner",
		"eprint/inbox/export:owner",
		"eprint/inbox/summary:owner",
		"eprint/inbox/destroy:owner",
		"eprint/inbox/deposit:owner",
		"eprint/inbox/edit:owner",
		"eprint/inbox/remove: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/export:owner",
		"eprint/buffer/summary:owner",
		"eprint/buffer/move_inbox: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/export:owner",
		"eprint/archive/summary: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/export:owner",
		"eprint/deletion/summary: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 => 
	[
		"datasets",

		"editorial_review",

		"eprint/inbox/view:editor",
		"eprint/inbox/export:editor",
		"eprint/inbox/summary:editor",
		"eprint/inbox/export:editor",
		"eprint/inbox/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/edit:editor",
		"eprint/inbox/takelock:editor",


		"eprint/buffer/view:editor",
		"eprint/buffer/export:editor",
		"eprint/buffer/summary:editor",
		"eprint/buffer/export:editor",
		"eprint/buffer/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/edit:editor",
		"eprint/buffer/takelock:editor",


		"eprint/archive/view:editor",
		"eprint/archive/export:editor",
		"eprint/archive/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/edit:editor",
		"eprint/archive/takelock:editor",


		"eprint/deletion/view:editor",
		"eprint/deletion/export:editor",
		"eprint/deletion/summary:editor",
		"eprint/deletion/export:editor",
		"eprint/deletion/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",
		"eprint/deletion/takelock:editor",
	],

	rest => [
		"eprint/archive/rest/get:editor",
		"eprint/archive/rest/put:editor",
		"eprint/buffer/rest/get:editor",
		"eprint/buffer/rest/put:editor",
		"eprint/inbox/rest/get:editor",
		"eprint/inbox/rest/put:editor",
		"eprint/deletion/rest/get:editor",
		"eprint/deletion/rest/put:editor",

		"eprint/inbox/rest/get:owner",
		"eprint/inbox/rest/put:owner",
		"eprint/buffer/rest/get:owner",
		"eprint/archive/rest/get:owner",
		"eprint/deletion/rest/get:owner",

		"user/rest/get:owner",

		"subject/rest/get",
	],
	
};

See Also