mirror of
				https://github.com/janeczku/calibre-web
				synced 2025-10-30 23:03:02 +00:00 
			
		
		
		
	Add send to ereader permission
This commit is contained in:
		| @@ -63,6 +63,7 @@ ROLE_ANONYMOUS          = 1 << 5 | |||||||
| ROLE_EDIT_SHELFS        = 1 << 6 | ROLE_EDIT_SHELFS        = 1 << 6 | ||||||
| ROLE_DELETE_BOOKS       = 1 << 7 | ROLE_DELETE_BOOKS       = 1 << 7 | ||||||
| ROLE_VIEWER             = 1 << 8 | ROLE_VIEWER             = 1 << 8 | ||||||
|  | ROLE_SEND_TO_EREADER    = 1 << 9 | ||||||
|  |  | ||||||
| ALL_ROLES = { | ALL_ROLES = { | ||||||
|                 "admin_role": ROLE_ADMIN, |                 "admin_role": ROLE_ADMIN, | ||||||
| @@ -73,6 +74,7 @@ ALL_ROLES = { | |||||||
|                 "edit_shelf_role": ROLE_EDIT_SHELFS, |                 "edit_shelf_role": ROLE_EDIT_SHELFS, | ||||||
|                 "delete_role": ROLE_DELETE_BOOKS, |                 "delete_role": ROLE_DELETE_BOOKS, | ||||||
|                 "viewer_role": ROLE_VIEWER, |                 "viewer_role": ROLE_VIEWER, | ||||||
|  |                 "send_to_ereader": ROLE_SEND_TO_EREADER, | ||||||
|             } |             } | ||||||
|  |  | ||||||
| DETAIL_RANDOM           = 1 <<  0 | DETAIL_RANDOM           = 1 <<  0 | ||||||
|   | |||||||
| @@ -20,6 +20,7 @@ | |||||||
|             <th class="hidden-xs hidden-sm">{{_('Upload')}}</th> |             <th class="hidden-xs hidden-sm">{{_('Upload')}}</th> | ||||||
|           {%  endif %} |           {%  endif %} | ||||||
|             <th class="hidden-xs hidden-sm">{{_('Download')}}</th> |             <th class="hidden-xs hidden-sm">{{_('Download')}}</th> | ||||||
|  |             <th class="hidden-xs hidden-sm">{{_('Send to eReader')}}</th> | ||||||
|             <th class="hidden-xs hidden-sm hidden-md">{{_('View Books')}}</th> |             <th class="hidden-xs hidden-sm hidden-md">{{_('View Books')}}</th> | ||||||
|             <th class="hidden-xs hidden-sm hidden-md">{{_('Edit')}}</th> |             <th class="hidden-xs hidden-sm hidden-md">{{_('Edit')}}</th> | ||||||
|             <th class="hidden-xs hidden-sm hidden-md">{{_('Delete')}}</th> |             <th class="hidden-xs hidden-sm hidden-md">{{_('Delete')}}</th> | ||||||
| @@ -38,6 +39,7 @@ | |||||||
|             <td class="hidden-xs hidden-sm">{{ display_bool_setting(user.role_upload()) }}</td> |             <td class="hidden-xs hidden-sm">{{ display_bool_setting(user.role_upload()) }}</td> | ||||||
|             {%  endif %} |             {%  endif %} | ||||||
|             <td class="hidden-xs hidden-sm">{{ display_bool_setting(user.role_download()) }}</td> |             <td class="hidden-xs hidden-sm">{{ display_bool_setting(user.role_download()) }}</td> | ||||||
|  |             <td class="hidden-xs hidden-sm">{{ display_bool_setting(user.role_send_to_ereader()) }}</td> | ||||||
|             <td class="hidden-xs hidden-sm hidden-md">{{ display_bool_setting(user.role_viewer()) }}</td> |             <td class="hidden-xs hidden-sm hidden-md">{{ display_bool_setting(user.role_viewer()) }}</td> | ||||||
|             <td class="hidden-xs hidden-sm hidden-md">{{ display_bool_setting(user.role_edit()) }}</td> |             <td class="hidden-xs hidden-sm hidden-md">{{ display_bool_setting(user.role_edit()) }}</td> | ||||||
|             <td class="hidden-xs hidden-sm hidden-md">{{ display_bool_setting(user.role_delete_books()) }}</td> |             <td class="hidden-xs hidden-sm hidden-md">{{ display_bool_setting(user.role_delete_books()) }}</td> | ||||||
|   | |||||||
| @@ -43,6 +43,8 @@ | |||||||
|                                 {% endif %} |                                 {% endif %} | ||||||
|                             </div> |                             </div> | ||||||
|                         {% endif %} |                         {% endif %} | ||||||
|  |                     {% endif %} | ||||||
|  |                     {% if current_user.role_send_to_ereader() %} | ||||||
|                         {% if current_user.kindle_mail and entry.email_share_list %} |                         {% if current_user.kindle_mail and entry.email_share_list %} | ||||||
|                             <input type="hidden" name="csrf_token" value="{{ csrf_token() }}"> |                             <input type="hidden" name="csrf_token" value="{{ csrf_token() }}"> | ||||||
|                             {% if entry.email_share_list.__len__() == 1 %} |                             {% if entry.email_share_list.__len__() == 1 %} | ||||||
|   | |||||||
| @@ -160,6 +160,9 @@ class UserBase: | |||||||
|     def role_viewer(self): |     def role_viewer(self): | ||||||
|         return self._has_role(constants.ROLE_VIEWER) |         return self._has_role(constants.ROLE_VIEWER) | ||||||
|  |  | ||||||
|  |     def role_send_to_ereader(self): | ||||||
|  |         return self._has_role(constants.ROLE_SEND_TO_EREADER) | ||||||
|  |  | ||||||
|     @property |     @property | ||||||
|     def is_active(self): |     def is_active(self): | ||||||
|         return True |         return True | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Jeremy Fisher
					Jeremy Fisher