Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display: Non-destructive feature should include send command #2768

Merged
merged 2 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
126 changes: 66 additions & 60 deletions lib/Controller/Display.php
Original file line number Diff line number Diff line change
Expand Up @@ -1031,7 +1031,7 @@
// Layout Assignments
$display->buttons[] = array(
'id' => 'displaygroup_button_layout_associations',
'url' => $this->urlFor($request, 'displayGroup.layout.form', ['id' => $display->displayGroupId]),

Check warning on line 1034 in lib/Controller/Display.php

View workflow job for this annotation

GitHub Actions / phpcs

Line exceeds 120 characters; contains 121 characters
'text' => __('Assign Layouts')
);
}
Expand Down Expand Up @@ -1177,20 +1177,24 @@
];
}

if ($this->getUser()->featureEnabled('displays.modify')
&& $this->getUser()->checkEditable($display)
// Check if limited view access is allowed
if (($this->getUser()->featureEnabled('displays.modify') && $this->getUser()->checkEditable($display))
|| $this->getUser()->featureEnabled('displays.limitedView')
) {
if ($this->getUser()->checkPermissionsModifyable($display)) {
$display->buttons[] = ['divider' => true];
}

// Wake On LAN
$display->buttons[] = array(
'id' => 'display_button_wol',
'url' => $this->urlFor($request, 'display.wol.form', ['id' => $display->displayId]),
'text' => __('Wake on LAN')
);
if ($this->getUser()->checkEditable($display)) {
// Wake On LAN
$display->buttons[] = array(
'id' => 'display_button_wol',
'url' => $this->urlFor($request, 'display.wol.form', ['id' => $display->displayId]),
'text' => __('Wake on LAN')
);
}

// Send Command
$display->buttons[] = [
'id' => 'displaygroup_button_command',
'url' => $this->urlFor($request, 'displayGroup.command.form', ['id' => $display->displayGroupId]),
Expand All @@ -1214,62 +1218,64 @@
]
];

$display->buttons[] = ['divider' => true];

$display->buttons[] = [
'id' => 'display_button_move_cms',
'url' => $this->urlFor($request, 'display.moveCms.form', ['id' => $display->displayId]),
'text' => __('Transfer to another CMS'),
'multi-select' => true,
'dataAttributes' => [
[
'name' => 'commit-url',
'value' => $this->urlFor(
$request,
'display.moveCms',
['id' => $display->displayId]
)
],
['name' => 'commit-method', 'value' => 'put'],
['name' => 'id', 'value' => 'display_button_move_cms'],
['name' => 'text', 'value' => __('Transfer to another CMS')],
['name' => 'sort-group', 'value' => 5],
['name' => 'rowtitle', 'value' => $display->display],
['name' => 'form-callback', 'value' => 'setMoveCmsMultiSelectFormOpen']
]
];
if ($this->getUser()->checkEditable($display)) {
$display->buttons[] = ['divider' => true];

$display->buttons[] = [
'multi-select' => true,
'multiSelectOnly' => true, // Show button only on multi-select menu
'id' => 'display_button_set_bandwidth',
'dataAttributes' => [
[
'name' => 'commit-url',
'value' => $this->urlFor(
$request,
'display.setBandwidthLimitMultiple'
)
],
['name' => 'commit-method', 'value' => 'post'],
['name' => 'id', 'value' => 'display_button_set_bandwidth'],
['name' => 'text', 'value' => __('Set Bandwidth')],
['name' => 'rowtitle', 'value' => $display->display],
['name' => 'custom-handler', 'value' => 'XiboMultiSelectPermissionsFormOpen'],
[
'name' => 'custom-handler-url',
'value' => $this->urlFor($request, 'display.setBandwidthLimitMultiple.form')
],
['name' => 'content-id-name', 'value' => 'displayId']
]
];
$display->buttons[] = [
'id' => 'display_button_move_cms',
'url' => $this->urlFor($request, 'display.moveCms.form', ['id' => $display->displayId]),
'text' => __('Transfer to another CMS'),
'multi-select' => true,
'dataAttributes' => [
[
'name' => 'commit-url',
'value' => $this->urlFor(
$request,
'display.moveCms',
['id' => $display->displayId]
)
],
['name' => 'commit-method', 'value' => 'put'],
['name' => 'id', 'value' => 'display_button_move_cms'],
['name' => 'text', 'value' => __('Transfer to another CMS')],
['name' => 'sort-group', 'value' => 5],
['name' => 'rowtitle', 'value' => $display->display],
['name' => 'form-callback', 'value' => 'setMoveCmsMultiSelectFormOpen']
]
];

if ($display->getUnmatchedProperty('isCmsTransferInProgress', false)) {
$display->buttons[] = [
'id' => 'display_button_move_cancel',
'url' => $this->urlFor($request, 'display.moveCmsCancel.form', ['id' => $display->displayId]),
'text' => __('Cancel CMS Transfer'),
'multi-select' => true,
'multiSelectOnly' => true, // Show button only on multi-select menu
'id' => 'display_button_set_bandwidth',
'dataAttributes' => [
[
'name' => 'commit-url',
'value' => $this->urlFor(
$request,
'display.setBandwidthLimitMultiple'
)
],
['name' => 'commit-method', 'value' => 'post'],
['name' => 'id', 'value' => 'display_button_set_bandwidth'],
['name' => 'text', 'value' => __('Set Bandwidth')],
['name' => 'rowtitle', 'value' => $display->display],
['name' => 'custom-handler', 'value' => 'XiboMultiSelectPermissionsFormOpen'],
[
'name' => 'custom-handler-url',
'value' => $this->urlFor($request, 'display.setBandwidthLimitMultiple.form')
],
['name' => 'content-id-name', 'value' => 'displayId']
]
];

if ($display->getUnmatchedProperty('isCmsTransferInProgress', false)) {
$display->buttons[] = [
'id' => 'display_button_move_cancel',
'url' => $this->urlFor($request, 'display.moveCmsCancel.form', ['id' => $display->displayId]),
'text' => __('Cancel CMS Transfer'),
];
}
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions lib/Controller/DisplayGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -1958,7 +1958,7 @@
$displayGroup = $this->displayGroupFactory->getById($id);

// Non-destructive edit-only feature; allow limited view access
if (

Check failure on line 1961 in lib/Controller/DisplayGroup.php

View workflow job for this annotation

GitHub Actions / phpcs

Expected 0 spaces after opening bracket; newline found
!$this->getUser()->checkEditable($displayGroup)
&& !$this->getUser()->featureEnabled('displays.limitedView')
&& !$this->getUser()->featureEnabled('displaygroup.limitedView')
Expand Down Expand Up @@ -2009,7 +2009,7 @@
$displayGroup = $this->displayGroupFactory->getById($id);

// Non-destructive edit-only feature; allow limited view access
if (

Check failure on line 2012 in lib/Controller/DisplayGroup.php

View workflow job for this annotation

GitHub Actions / phpcs

Expected 0 spaces after opening bracket; newline found
!$this->getUser()->checkEditable($displayGroup)
&& !$this->getUser()->featureEnabled('displays.limitedView')
&& !$this->getUser()->featureEnabled('displaygroup.limitedView')
Expand Down Expand Up @@ -2442,9 +2442,10 @@
$displayGroup = $this->displayGroupFactory->getById($id);

// Non-destructive edit-only feature; allow limited view access
if (

Check failure on line 2445 in lib/Controller/DisplayGroup.php

View workflow job for this annotation

GitHub Actions / phpcs

Expected 0 spaces after opening bracket; newline found
!$this->getUser()->checkEditable($displayGroup)
&& !$this->getUser()->featureEnabled('displaygroup.limitedView')
&& !$this->getUser()->featureEnabled('displays.limitedView')
) {
throw new AccessDeniedException();
}
Expand Down Expand Up @@ -2507,9 +2508,10 @@
$sanitizedParams = $this->getSanitizer($request->getParams());

// Non-destructive edit-only feature; allow limited view access
if (

Check failure on line 2511 in lib/Controller/DisplayGroup.php

View workflow job for this annotation

GitHub Actions / phpcs

Expected 0 spaces after opening bracket; newline found
!$this->getUser()->checkEditable($displayGroup)
&& !$this->getUser()->featureEnabled('displaygroup.limitedView')
&& !$this->getUser()->featureEnabled('displays.limitedView')
) {
throw new AccessDeniedException();
}
Expand Down
Loading