1
0
mirror of https://github.com/janeczku/calibre-web synced 2024-11-15 22:34:56 +00:00
This commit is contained in:
apollo1220 2024-02-29 04:46:36 -08:00 committed by GitHub
commit ac67534b68
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 9 additions and 0 deletions

View File

@ -68,6 +68,7 @@ ROLE_ANONYMOUS = 1 << 5
ROLE_EDIT_SHELFS = 1 << 6
ROLE_DELETE_BOOKS = 1 << 7
ROLE_VIEWER = 1 << 8
ROLE_SEND_TO_EREADER = 1 << 9
ALL_ROLES = {
"admin_role": ROLE_ADMIN,
@ -78,6 +79,7 @@ ALL_ROLES = {
"edit_shelf_role": ROLE_EDIT_SHELFS,
"delete_role": ROLE_DELETE_BOOKS,
"viewer_role": ROLE_VIEWER,
"send_to_ereader": ROLE_SEND_TO_EREADER,
}
DETAIL_RANDOM = 1 << 0

View File

@ -20,6 +20,7 @@
<th class="hidden-xs hidden-sm">{{_('Upload')}}</th>
{% endif %}
<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">{{_('Edit')}}</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>
{% 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_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_edit()) }}</td>
<td class="hidden-xs hidden-sm hidden-md">{{ display_bool_setting(user.role_delete_books()) }}</td>

View File

@ -43,6 +43,8 @@
{% endif %}
</div>
{% endif %}
{% endif %}
{% if current_user.role_send_to_ereader() %}
{% if current_user.kindle_mail and entry.email_share_list %}
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
{% if entry.email_share_list.__len__() == 1 %}

View File

@ -160,6 +160,9 @@ class UserBase:
def role_viewer(self):
return self._has_role(constants.ROLE_VIEWER)
def role_send_to_ereader(self):
return self._has_role(constants.ROLE_SEND_TO_EREADER)
@property
def is_active(self):
return True