🐛 Fix use of TIMELAPSE_MANAGE_UNRENDERED

This commit is contained in:
Gina Häußge committed 2023-03-06 16:12:41 +01:00
1 parent 01cdb5e18c
commit efe9c68e9a
4 files changed
+16 -8

No files matched your search

+2 -2
View File
@@ -48,7 +48,7 @@ Issue a command for an unrendered timelapse
Current only supports to render the unrendered timelapse ``name`` via the
``render`` command.
Requires the ``TIMELAPSE_ADMIN`` permission.
Requires the ``TIMELAPSE_MANAGE_UNRENDERED`` permission.
:json command: The command to issue, currently only ``render`` is supported
@@ -64,7 +64,7 @@ Delete an unrendered timelapse
Returns a :ref:`timelapse list <sec-api-timelapse-datamodel-list>` in the
response body.
Requires the ``TIMELAPSE_DELETE`` permission.
Requires the ``TIMELAPSE_MANAGE_UNRENDERED`` permission.
:param unrendered: If provided and true, also include unrendered timelapses in the response
+1 -1
View File
@@ -414,7 +414,7 @@ class Permissions(metaclass=PermissionsMetaClass):
)
TIMELAPSE_DELETE = OctoPrintPermission(
"Timelapse Delete",
gettext("Allows to delete timelapse videos and unrendered timelapses"),
gettext("Allows to delete timelapse videos"),
RoleNeed("timelapse_delete"),
default_groups=[USER_GROUP],
)
@@ -443,7 +443,11 @@ $(function () {
};
self.removeUnrendered = function (name) {
if (!self.loginState.hasPermission(self.access.permissions.TIMELAPSE_DELETE))
if (
!self.loginState.hasPermission(
self.access.permissions.TIMELAPSE_MANAGE_UNRENDERED
)
)
return;
var perform = function () {
@@ -463,7 +467,11 @@ $(function () {
};
self.removeMarkedUnrendered = function () {
if (!self.loginState.hasPermission(self.access.permissions.TIMELAPSE_DELETE))
if (
!self.loginState.hasPermission(
self.access.permissions.TIMELAPSE_MANAGE_UNRENDERED
)
)
return;
var perform = function () {
@@ -194,7 +194,7 @@
<div data-bind="visible: unrenderedListHelper.allSize">
<div><small><a href="javascript:void(0)" class="muted" onclick="$(this).children().toggleClass('fa-caret-right fa-caret-down').parent().parent().parent().next().slideToggle('fast')"><i class="fas fa-caret-right"></i> {{ _('Unrendered Timelapses') }}</a></small></div>
<div class="hide">
<div class="pull-left" data-bind="visible: $root.loginState.hasPermissionKo($root.access.permissions.TIMELAPSE_DELETE)">
<div class="pull-left" data-bind="visible: $root.loginState.hasPermissionKo($root.access.permissions.TIMELAPSE_MANAGE_UNRENDERED)">
<div class="btn-group">
<button class="btn btn-small dropdown-toggle" data-toggle="dropdown"><i class="fas fa-square"></i> <span class="caret"></span></button>
<ul class="dropdown-menu">
@@ -218,13 +218,13 @@
</thead>
<tbody data-bind="foreach: unrenderedListHelper.paginatedItems">
<tr data-bind="attr: {title: name}">
<td class="timelapse_unrendered_checkbox"><input type="checkbox" data-bind="value: name, checked: $root.markedForUnrenderedDeletion, invisible: !$root.loginState.hasPermissionKo($root.access.permissions.TIMELAPSE_DELETE)()"></td>
<td class="timelapse_unrendered_checkbox"><input type="checkbox" data-bind="value: name, checked: $root.markedForUnrenderedDeletion, invisible: !$root.loginState.hasPermissionKo($root.access.permissions.TIMELAPSTIMELAPSE_MANAGE_UNRENDEREDE_DELETE)()"></td>
<td class="timelapse_unrendered_name" data-bind="text: name"></td>
<td class="timelapse_unrendered_count" data-bind="text: count"></td>
<td class="timelapse_unrendered_size" data-bind="text: size"></td>
<td class="timelapse_unrendered_action">
<span data-bind="visible: processing"><i class="fas fa-sync fa-spin"></i></span>
<span data-bind="visible: !processing"><a href="javascript:void(0)" title="{{ _('Delete unrendered timelapse')|edq }}" class="far fa-trash-alt" data-bind="click: function() { $parent.removeUnrendered($data.name); }, css: {disabled: !$root.loginState.hasPermissionKo($root.access.permissions.TIMELAPSE_DELETE)()}"></a>&nbsp;|&nbsp;<a href="javascript:void(0)" title="{{ _('Render timelapse')|edq }}" class="fas fa-video" data-bind="click: function() { if (!$root.isBusy()) { $parent.renderUnrendered($data.name); } else { return; } }, css: {disabled: $root.isBusy() || !$root.loginState.hasPermissionKo($root.access.permissions.TIMELAPSE_ADMIN)()}"></a></span>
<span data-bind="visible: !processing"><a href="javascript:void(0)" title="{{ _('Delete unrendered timelapse')|edq }}" class="far fa-trash-alt" data-bind="click: function() { $parent.removeUnrendered($data.name); }, css: {disabled: !$root.loginState.hasPermissionKo($root.access.permissions.TIMELAPSE_MANAGE_UNRENDERED)()}"></a>&nbsp;|&nbsp;<a href="javascript:void(0)" title="{{ _('Render timelapse')|edq }}" class="fas fa-video" data-bind="click: function() { if (!$root.isBusy()) { $parent.renderUnrendered($data.name); } else { return; } }, css: {disabled: $root.isBusy() || !$root.loginState.hasPermissionKo($root.access.permissions.TIMELAPSE_ADMIN)()}"></a></span>
</td>
</tr>
</tbody>