Update subusers view

This commit is contained in:
Dane Everitt 2017-03-30 15:30:59 -04:00
parent f2f834af49
commit 95c739a3f3
No known key found for this signature in database
GPG Key ID: EEA66103B3D71F53
8 changed files with 145 additions and 658 deletions

View File

@ -3,6 +3,13 @@ This file is a running track of new features and fixes to each version of the pa
This project follows [Semantic Versioning](http://semver.org) guidelines.
## v0.6.0-pre.8 (Courageous Carniadactylus)
### Fixed
* `[pre.7]` — Fixes bug with subuser checkbox display.
### Changed
* Subuser permissions are now stored in `Permission::list()` to make views way cleaner and make adding to views significantly cleaner.
## v0.6.0-pre.7 (Courageous Carniadactylus)
### Fixed
* `[pre.6]` — Addresses misconfigured console queue that was still sending data way to quickly thus causing the console to explode on some devices when large amounts of data were sent.

View File

@ -79,6 +79,7 @@ class SubuserController extends Controller
'server' => $server,
'node' => $server->node,
'subuser' => $subuser,
'permlist' => Models\Permission::list(),
'permissions' => $subuser->permissions->mapWithKeys(function ($item, $key) {
return [$item->permission => true];
}),
@ -146,6 +147,7 @@ class SubuserController extends Controller
return view('server.users.new', [
'server' => $server,
'permissions' => Models\Permission::list(),
'node' => $server->node,
]);
}

View File

@ -58,6 +58,80 @@ class Permission extends Model
'subuser_id' => 'integer',
];
/**
* A list of all permissions available for a user.
*
* @var array
*/
protected static $permissions = [
'power' => [
'power-start' => 's:power:start',
'power-stop' => 's:power:stop',
'power-restart' => 's:power:restart',
'power-kill' => 's:power:kill',
'send-command' => 's:command',
],
'subuser' => [
'list-subusers' => null,
'view-subuser' => null,
'edit-subuser' => null,
'create-subuser' => null,
'delete-subuser' => null,
],
'server' => [
'set-connection' => null,
'view-startup' => null,
'edit-startup' => null,
],
'sftp' => [
'view-sftp' => null,
'view-sftp-password' => null,
'reset-sftp' => 's:set-password',
],
'file' => [
'list-files' => 's:files:get',
'edit-files' => 's:files:read',
'save-files' => 's:files:post',
'move-files' => 's:files:move',
'copy-files' => 's:files:copy',
'compress-files' => 's:files:compress',
'decompress-files' => 's:files:decompress',
'create-files' => 's:files:create',
'upload-files' => 's:files:upload',
'delete-files' => 's:files:delete',
'download-files' => null,
],
'task' => [
'list-tasks' => null,
'view-task' => null,
'toggle-task' => null,
'queue-task' => null,
'create-task' => null,
'delete-task' => null,
],
'database' => [
'view-databases' => null,
'reset-db-password' => null,
],
];
/**
* Return a collection of permissions available.
*
* @param array $single
* @return \Illuminate\Support\Collection|array
*/
public static function list($single = false)
{
if ($single) {
return collect(self::$permissions)->mapWithKeys(function ($item) {
return $item;
})->all();
}
return collect(self::$permissions);
}
/**
* Find permission by permission node.
*

View File

@ -45,62 +45,6 @@ class SubuserRepository
's:console',
];
/**
* Allowed permissions and their related daemon permission.
*
* @var array
*/
protected $permissions = [
// Power Permissions
'power-start' => 's:power:start',
'power-stop' => 's:power:stop',
'power-restart' => 's:power:restart',
'power-kill' => 's:power:kill',
// Commands
'send-command' => 's:command',
// File Manager
'list-files' => 's:files:get',
'edit-files' => 's:files:read',
'save-files' => 's:files:post',
'create-files' => 's:files:create',
'download-files' => null,
'upload-files' => 's:files:upload',
'delete-files' => 's:files:delete',
'move-files' => 's:files:move',
'copy-files' => 's:files:copy',
'compress-files' => 's:files:compress',
'decompress-files' => 's:files:decompress',
// Subusers
'list-subusers' => null,
'view-subuser' => null,
'edit-subuser' => null,
'create-subuser' => null,
'delete-subuser' => null,
// Tasks
'list-tasks' => null,
'view-task' => null,
'toggle-task' => null,
'delete-task' => null,
'create-task' => null,
'queue-task' => null,
// Management
'set-connection' => null,
'view-startup' => null,
'edit-startup' => null,
'view-sftp' => null,
'reset-sftp' => 's:set-password',
'view-sftp-password' => null,
// Databases
'view-databases' => null,
'reset-db-password' => null,
];
/**
* Creates a new subuser on the server.
*
@ -155,12 +99,14 @@ class SubuserRepository
'daemonSecret' => (string) $uuid->generate('servers', 'uuid'),
]);
$perms = Permission::list(true);
$daemonPermissions = $this->coreDaemonPermissions;
foreach ($data['permissions'] as $permission) {
if (array_key_exists($permission, $this->permissions)) {
if (array_key_exists($permission, $perms)) {
// Build the daemon permissions array for sending.
if (! is_null($this->permissions[$permission])) {
array_push($daemonPermissions, $this->permissions[$permission]);
if (! is_null($perms[$permission])) {
array_push($daemonPermissions, $perms[$permission]);
}
Models\Permission::create([
@ -272,12 +218,14 @@ class SubuserRepository
$permission->delete();
}
$perms = Permission::list(true);
$daemonPermissions = $this->coreDaemonPermissions;
foreach ($data['permissions'] as $permission) {
if (array_key_exists($permission, $this->permissions)) {
if (array_key_exists($permission, $perms)) {
// Build the daemon permissions array for sending.
if (! is_null($this->permissions[$permission])) {
array_push($daemonPermissions, $this->permissions[$permission]);
if (! is_null($perms[$permission])) {
array_push($daemonPermissions, $perms[$permission]);
}
Models\Permission::create([
'subuser_id' => $subuser->id,

View File

@ -276,3 +276,7 @@ span[aria-labelledby="select2-pUserId-container"] {
.btn-icon > i.fa {
line-height: 1.5;
}
.strong {
font-weight: bold !important;
}

View File

@ -59,24 +59,24 @@ return [
'server_header' => 'Server Management',
'task_header' => 'Task Management',
'sftp_header' => 'SFTP Management',
'db_header' => 'Database Management',
'start' => [
'database_header' => 'Database Management',
'power_start' => [
'title' => 'Start Server',
'description' => 'Allows user to start the server.',
],
'stop' => [
'power_stop' => [
'title' => 'Stop Server',
'description' => 'Allows user to stop the server.',
],
'restart' => [
'power_restart' => [
'title' => 'Restart Server',
'description' => 'Allows user to restart the server.',
],
'kill' => [
'power_kill' => [
'title' => 'Kill Server',
'description' => 'Allows user to kill the server process.',
],
'command' => [
'send_command' => [
'title' => 'Send Console Command',
'description' => 'Allows sending a command from the console. If the user does not have stop or restart permissions they cannot send the application\'s stop command.',
],

View File

@ -60,340 +60,31 @@
</div>
</div>
<div class="row">
@foreach($permissions as $block => $perms)
<div class="col-sm-6">
{{-- Left Side --}}
<div class="row">
<div class="col-sm-12">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">@lang('server.users.new.power_header')</h3>
<h3 class="box-title">@lang('server.users.new.' . $block . '_header')</h3>
</div>
<div class="box-body">
<div class="checkbox">
<label>
<input name="permissions[]" type="checkbox" @if(isset($oldInput['power-start']))checked="checked"@endif value="power-start" />
<strong>@lang('server.users.new.start.title')</strong>
<p class="text-muted small">@lang('server.users.new.start.description')</p>
@foreach($perms as $permission => $daemon)
<div class="form-group">
<div class="checkbox checkbox-primary no-margin-bottom">
<input id="{{ $permission }}" name="permissions[]" type="checkbox" value="{{ $permission }}"/>
<label for="{{ $permission }}" class="strong">
@lang('server.users.new.' . str_replace('-', '_', $permission) . '.title')
</label>
</div>
<div class="checkbox">
<label>
<input name="permissions[]" type="checkbox" @if(isset($oldInput['power-stop']))checked="checked"@endif value="power-stop" />
<strong>@lang('server.users.new.stop.title')</strong>
<p class="text-muted small">@lang('server.users.new.stop.description')</p>
</label>
</div>
<div class="checkbox">
<label>
<input name="permissions[]" type="checkbox" @if(isset($oldInput['power-restart']))checked="checked"@endif value="power-restart" />
<strong>@lang('server.users.new.restart.title')</strong>
<p class="text-muted small">@lang('server.users.new.restart.description')</p>
</label>
</div>
<div class="checkbox">
<label>
<input name="permissions[]" type="checkbox" @if(isset($oldInput['power-kill']))checked="checked"@endif value="power-kill" />
<strong>@lang('server.users.new.kill.title')</strong>
<p class="text-muted small">@lang('server.users.new.kill.description')</p>
</label>
</div>
<div class="checkbox">
<label>
<input name="permissions[]" type="checkbox" @if(isset($oldInput['send-command']))checked="checked"@endif value="send-command" />
<strong>@lang('server.users.new.command.title')</strong>
<p class="text-muted small">@lang('server.users.new.command.description')</p>
</label>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">@lang('server.users.new.subuser_header')</h3>
</div>
<div class="box-body">
<div class="checkbox">
<label>
<input name="permissions[]" type="checkbox" @if(isset($oldInput['list-subusers']))checked="checked"@endif value="list-subusers" />
<strong>@lang('server.users.new.list_subusers.title')</strong>
<p class="text-muted small">@lang('server.users.new.list_subusers.description')</p>
</label>
</div>
<div class="checkbox">
<label>
<input name="permissions[]" type="checkbox" @if(isset($oldInput['view-subuser']))checked="checked"@endif value="view-subuser" />
<strong>@lang('server.users.new.view_subuser.title')</strong>
<p class="text-muted small">@lang('server.users.new.view_subuser.description')</p>
</label>
</div>
<div class="checkbox">
<label>
<input name="permissions[]" type="checkbox" @if(isset($oldInput['edit-subuser']))checked="checked"@endif value="edit-subuser" />
<strong>@lang('server.users.new.edit_subuser.title')</strong>
<p class="text-muted small">@lang('server.users.new.edit_subuser.description')</p>
</label>
</div>
<div class="checkbox">
<label>
<input name="permissions[]" type="checkbox" @if(isset($oldInput['create-subuser']))checked="checked"@endif value="create-subuser" />
<strong>@lang('server.users.new.create_subuser.title')</strong>
<p class="text-muted small">@lang('server.users.new.create_subuser.description')</p>
</label>
</div>
<div class="checkbox">
<label>
<input name="permissions[]" type="checkbox" @if(isset($oldInput['delete-subuser']))checked="checked"@endif value="delete-subuser" />
<strong>@lang('server.users.new.delete_subuser.title')</strong>
<p class="text-muted small">@lang('server.users.new.delete_subuser.description')</p>
</label>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">@lang('server.users.new.server_header')</h3>
</div>
<div class="box-body">
<div class="checkbox">
<label>
<input name="permissions[]" type="checkbox" @if(isset($oldInput['set-connection']))checked="checked"@endif value="set-connection" />
<strong>@lang('server.users.new.set_connection.title')</strong>
<p class="text-muted small">@lang('server.users.new.set_connection.description')</p>
</label>
</div>
<div class="checkbox">
<label>
<input name="permissions[]" type="checkbox" @if(isset($oldInput['view-startup']))checked="checked"@endif value="view-startup" />
<strong>@lang('server.users.new.view_startup.title')</strong>
<p class="text-muted small">@lang('server.users.new.view_startup.description')</p>
</label>
</div>
<div class="checkbox">
<label>
<input name="permissions[]" type="checkbox" @if(isset($oldInput['edit-startup']))checked="checked"@endif value="edit-startup" />
<strong>@lang('server.users.new.edit_startup.title')</strong>
<p class="text-muted small">@lang('server.users.new.edit_startup.description')</p>
</label>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">@lang('server.users.new.sftp_header')</h3>
</div>
<div class="box-body">
<div class="checkbox">
<label>
<input name="permissions[]" type="checkbox" @if(isset($oldInput['view-sftp']))checked="checked"@endif value="view-sftp" />
<strong>@lang('server.users.new.view_sftp.title')</strong>
<p class="text-muted small">@lang('server.users.new.view_sftp.description')</p>
</label>
</div>
<div class="checkbox">
<label>
<input name="permissions[]" type="checkbox" @if(isset($oldInput['view-sftp-password']))checked="checked"@endif value="view-sftp-password" />
<span class="label label-danger">@lang('strings.danger')</span>
<strong>@lang('server.users.new.view_sftp_password.title')</strong>
<p class="text-muted small">@lang('server.users.new.view_sftp_password.description')</p>
</label>
</div>
<div class="checkbox">
<label>
<input name="permissions[]" type="checkbox" @if(isset($oldInput['reset-sftp']))checked="checked"@endif value="reset-sftp" />
<strong>@lang('server.users.new.reset_sftp.title')</strong>
<p class="text-muted small">@lang('server.users.new.reset_sftp.description')</p>
</label>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-sm-6">
{{-- Right Side --}}
<div class="row">
<div class="col-sm-12">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">@lang('server.users.new.file_header')</h3>
</div>
<div class="box-body">
<div class="checkbox">
<label>
<input name="permissions[]" type="checkbox" @if(isset($oldInput['list-files']))checked="checked"@endif value="list-files" />
<strong>@lang('server.users.new.list_files.title')</strong>
<p class="text-muted small">@lang('server.users.new.list_files.description')</p>
</label>
</div>
<div class="checkbox">
<label>
<input name="permissions[]" type="checkbox" @if(isset($oldInput['edit-files']))checked="checked"@endif value="edit-files" />
<strong>@lang('server.users.new.edit_files.title')</strong>
<p class="text-muted small">@lang('server.users.new.edit_files.description')</p>
</label>
</div>
<div class="checkbox">
<label>
<input name="permissions[]" type="checkbox" @if(isset($oldInput['save-files']))checked="checked"@endif value="save-files" />
<strong>@lang('server.users.new.save_files.title')</strong>
<p class="text-muted small">@lang('server.users.new.save_files.description')</p>
</label>
</div>
<div class="checkbox">
<label>
<input name="permissions[]" type="checkbox" @if(isset($oldInput['move-files']))checked="checked"@endif value="move-files" />
<strong>@lang('server.users.new.move_files.title')</strong>
<p class="text-muted small">@lang('server.users.new.move_files.description')</p>
</label>
</div>
<div class="checkbox">
<label>
<input name="permissions[]" type="checkbox" @if(isset($oldInput['copy-files']))checked="checked"@endif value="copy-files" />
<strong>@lang('server.users.new.copy_files.title')</strong>
<p class="text-muted small">@lang('server.users.new.copy_files.description')</p>
</label>
</div>
<div class="checkbox">
<label>
<input name="permissions[]" type="checkbox" @if(isset($oldInput['compress-files']))checked="checked"@endif value="compress-files" />
<strong>@lang('server.users.new.compress_files.title')</strong>
<p class="text-muted small">@lang('server.users.new.compress_files.description')</p>
</label>
</div>
<div class="checkbox">
<label>
<input name="permissions[]" type="checkbox" @if(isset($oldInput['decompress-files']))checked="checked"@endif value="decompress-files" />
<strong>@lang('server.users.new.decompress_files.title')</strong>
<p class="text-muted small">@lang('server.users.new.decompress_files.description')</p>
</label>
</div>
<div class="checkbox">
<label>
<input name="permissions[]" type="checkbox" @if(isset($oldInput['create-files']))checked="checked"@endif value="create-files" />
<strong>@lang('server.users.new.create_files.title')</strong>
<p class="text-muted small">@lang('server.users.new.create_files.description')</p>
</label>
</div>
<div class="checkbox">
<label>
<input name="permissions[]" type="checkbox" @if(isset($oldInput['upload-files']))checked="checked"@endif value="upload-files" />
<strong>@lang('server.users.new.upload_files.title')</strong>
<p class="text-muted small">@lang('server.users.new.upload_files.description')</p>
</label>
</div>
<div class="checkbox">
<label>
<input name="permissions[]" type="checkbox" @if(isset($oldInput['delete-files']))checked="checked"@endif value="delete-files" />
<span class="label label-danger">@lang('strings.danger')</span>
<strong>@lang('server.users.new.delete_files.title')</strong>
<p class="text-muted small">@lang('server.users.new.delete_files.description')</p>
</label>
</div>
<div class="checkbox">
<label>
<input name="permissions[]" type="checkbox" @if(isset($oldInput['download-files']))checked="checked"@endif value="download-files" />
<span class="label label-danger">@lang('strings.danger')</span>
<strong>@lang('server.users.new.download_files.title')</strong>
<p class="text-muted small">@lang('server.users.new.download_files.description')</p>
</label>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">@lang('server.users.new.task_header')</h3>
</div>
<div class="box-body">
<div class="checkbox">
<label>
<input name="permissions[]" type="checkbox" @if(isset($oldInput['list-tasks']))checked="checked"@endif value="list-tasks" />
<strong>@lang('server.users.new.list_tasks.title')</strong>
<p class="text-muted small">@lang('server.users.new.list_tasks.description')</p>
</label>
</div>
<div class="checkbox">
<label>
<input name="permissions[]" type="checkbox" @if(isset($oldInput['view-task']))checked="checked"@endif value="view-task" />
<strong>@lang('server.users.new.view_task.title')</strong>
<p class="text-muted small">@lang('server.users.new.view_task.description')</p>
</label>
</div>
<div class="checkbox">
<label>
<input name="permissions[]" type="checkbox" @if(isset($oldInput['toggle-task']))checked="checked"@endif value="toggle-task" />
<strong>@lang('server.users.new.toggle_task.title')</strong>
<p class="text-muted small">@lang('server.users.new.toggle_task.description')</p>
</label>
</div>
<div class="checkbox">
<label>
<input name="permissions[]" type="checkbox" @if(isset($oldInput['queue-task']))checked="checked"@endif value="queue-task" />
<strong>@lang('server.users.new.queue_task.title')</strong>
<p class="text-muted small">@lang('server.users.new.queue_task.description')</p>
</label>
</div>
<div class="checkbox">
<label>
<input name="permissions[]" type="checkbox" @if(isset($oldInput['create-task']))checked="checked"@endif value="create-task" />
<strong>@lang('server.users.new.create_task.title')</strong>
<p class="text-muted small">@lang('server.users.new.create_task.description')</p>
</label>
</div>
<div class="checkbox">
<label>
<input name="permissions[]" type="checkbox" @if(isset($oldInput['delete-task']))checked="checked"@endif value="delete-task" />
<span class="label label-danger">@lang('strings.danger')</span>
<strong>@lang('server.users.new.delete_task.title')</strong>
<p class="text-muted small">@lang('server.users.new.delete_task.description')</p>
</label>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">@lang('server.users.new.db_header')</h3>
</div>
<div class="box-body">
<div class="checkbox">
<label>
<input name="permissions[]" type="checkbox" @if(isset($oldInput['view-databases']))checked="checked"@endif value="view-databases" />
<span class="label label-danger">@lang('strings.danger')</span>
<strong>@lang('server.users.new.view_databases.title')</strong>
<p class="text-muted small">@lang('server.users.new.view_databases.description')</p>
</label>
</div>
<div class="checkbox">
<label>
<input name="permissions[]" type="checkbox" @if(isset($oldInput['reset-db-password']))checked="checked"@endif value="reset-db-password" />
<span class="label label-danger">@lang('strings.danger')</span>
<strong>@lang('server.users.new.reset_db_password.title')</strong>
<p class="text-muted small">@lang('server.users.new.reset_db_password.description')</p>
</label>
</div>
</div>
<p class="text-muted small">@lang('server.users.new.' . str_replace('-', '_', $permission) . '.description')</p>
</div>
@endforeach
</div>
</div>
</div>
@if ($loop->iteration % 2 === 0)
<div class="clearfix visible-lg-block visible-md-block visible-sm-block"></div>
@endif
@endforeach
</div>
</form>
@endsection

View File

@ -62,270 +62,31 @@
</div>
</div>
<div class="row">
@foreach($permlist as $block => $perms)
<div class="col-sm-6">
{{-- Left Side --}}
<div class="row">
<div class="col-sm-12">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">@lang('server.users.new.power_header')</h3>
<h3 class="box-title">@lang('server.users.new.' . $block . '_header')</h3>
</div>
<div class="box-body">
<div>
<input name="permissions[]" type="checkbox" @if(isset($permissions['power-start']))checked="checked"@endif @cannot('edit-subuser', $server)disabled="disabled"@endcannot value="power-start" />
<label class="form-label">@lang('server.users.new.start.title')</label>
<p class="text-muted small">@lang('server.users.new.start.description')</p>
</div>
<div>
<input name="permissions[]" type="checkbox" @if(isset($permissions['power-stop']))checked="checked"@endif @cannot('edit-subuser', $server)disabled="disabled"@endcannot value="power-stop" />
<strong>@lang('server.users.new.stop.title')</strong>
<p class="text-muted small">@lang('server.users.new.stop.description')</p>
</div>
<div>
<input name="permissions[]" type="checkbox" @if(isset($permissions['power-restart']))checked="checked"@endif @cannot('edit-subuser', $server)disabled="disabled"@endcannot value="power-restart" />
<strong>@lang('server.users.new.restart.title')</strong>
<p class="text-muted small">@lang('server.users.new.restart.description')</p>
</div>
<div>
<input name="permissions[]" type="checkbox" @if(isset($permissions['power-kill']))checked="checked"@endif @cannot('edit-subuser', $server)disabled="disabled"@endcannot value="power-kill" />
<strong>@lang('server.users.new.kill.title')</strong>
<p class="text-muted small">@lang('server.users.new.kill.description')</p>
</div>
<div>
<input name="permissions[]" type="checkbox" @if(isset($permissions['send-command']))checked="checked"@endif @cannot('edit-subuser', $server)disabled="disabled"@endcannot value="send-command" />
<strong>@lang('server.users.new.command.title')</strong>
<p class="text-muted small">@lang('server.users.new.command.description')</p>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">@lang('server.users.new.subuser_header')</h3>
</div>
<div class="box-body">
<div>
<input name="permissions[]" type="checkbox" @if(isset($permissions['list-subusers']))checked="checked"@endif @cannot('edit-subuser', $server)disabled="disabled"@endcannot value="list-subusers" />
<strong>@lang('server.users.new.list_subusers.title')</strong>
<p class="text-muted small">@lang('server.users.new.list_subusers.description')</p>
</div>
<div>
<input name="permissions[]" type="checkbox" @if(isset($permissions['view-subuser']))checked="checked"@endif @cannot('edit-subuser', $server)disabled="disabled"@endcannot value="view-subuser" />
<strong>@lang('server.users.new.view_subuser.title')</strong>
<p class="text-muted small">@lang('server.users.new.view_subuser.description')</p>
</div>
<div>
<input name="permissions[]" type="checkbox" @if(isset($permissions['edit-subuser']))checked="checked"@endif @cannot('edit-subuser', $server)disabled="disabled"@endcannot value="edit-subuser" />
<strong>@lang('server.users.new.edit_subuser.title')</strong>
<p class="text-muted small">@lang('server.users.new.edit_subuser.description')</p>
</div>
<div>
<input name="permissions[]" type="checkbox" @if(isset($permissions['create-subuser']))checked="checked"@endif @cannot('edit-subuser', $server)disabled="disabled"@endcannot value="create-subuser" />
<strong>@lang('server.users.new.create_subuser.title')</strong>
<p class="text-muted small">@lang('server.users.new.create_subuser.description')</p>
</div>
<div>
<input name="permissions[]" type="checkbox" @if(isset($permissions['delete-subuser']))checked="checked"@endif @cannot('edit-subuser', $server)disabled="disabled"@endcannot value="delete-subuser" />
<strong>@lang('server.users.new.delete_subuser.title')</strong>
<p class="text-muted small">@lang('server.users.new.delete_subuser.description')</p>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">@lang('server.users.new.server_header')</h3>
</div>
<div class="box-body">
<div>
<input name="permissions[]" type="checkbox" @if(isset($permissions['set-connection']))checked="checked"@endif @cannot('edit-subuser', $server)disabled="disabled"@endcannot value="set-connection" />
<strong>@lang('server.users.new.set_connection.title')</strong>
<p class="text-muted small">@lang('server.users.new.set_connection.description')</p>
</div>
<div>
<input name="permissions[]" type="checkbox" @if(isset($permissions['view-startup']))checked="checked"@endif @cannot('edit-subuser', $server)disabled="disabled"@endcannot value="view-startup" />
<strong>@lang('server.users.new.view_startup.title')</strong>
<p class="text-muted small">@lang('server.users.new.view_startup.description')</p>
</div>
<div>
<input name="permissions[]" type="checkbox" @if(isset($permissions['edit-startup']))checked="checked"@endif @cannot('edit-subuser', $server)disabled="disabled"@endcannot value="edit-startup" />
<strong>@lang('server.users.new.edit_startup.title')</strong>
<p class="text-muted small">@lang('server.users.new.edit_startup.description')</p>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">@lang('server.users.new.sftp_header')</h3>
</div>
<div class="box-body">
<div>
<input name="permissions[]" type="checkbox" @if(isset($permissions['view-sftp']))checked="checked"@endif @cannot('edit-subuser', $server)disabled="disabled"@endcannot value="view-sftp" />
<strong>@lang('server.users.new.view_sftp.title')</strong>
<p class="text-muted small">@lang('server.users.new.view_sftp.description')</p>
</div>
<div>
<input name="permissions[]" type="checkbox" @if(isset($permissions['view-sftp-password']))checked="checked"@endif @cannot('edit-subuser', $server)disabled="disabled"@endcannot value="view-sftp-password" />
<span class="label label-danger">@lang('strings.danger')</span>
<strong>@lang('server.users.new.view_sftp_password.title')</strong>
<p class="text-muted small">@lang('server.users.new.view_sftp_password.description')</p>
</div>
<div>
<input name="permissions[]" type="checkbox" @if(isset($permissions['reset-sftp']))checked="checked"@endif @cannot('edit-subuser', $server)disabled="disabled"@endcannot value="reset-sftp" />
<strong>@lang('server.users.new.reset_sftp.title')</strong>
<p class="text-muted small">@lang('server.users.new.reset_sftp.description')</p>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-sm-6">
{{-- Right Side --}}
<div class="row">
<div class="col-sm-12">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">@lang('server.users.new.file_header')</h3>
</div>
<div class="box-body">
<div>
<input name="permissions[]" type="checkbox" @if(isset($permissions['list-files']))checked="checked"@endif @cannot('edit-subuser', $server)disabled="disabled"@endcannot value="list-files" />
<strong>@lang('server.users.new.list_files.title')</strong>
<p class="text-muted small">@lang('server.users.new.list_files.description')</p>
</div>
<div>
<input name="permissions[]" type="checkbox" @if(isset($permissions['edit-files']))checked="checked"@endif @cannot('edit-subuser', $server)disabled="disabled"@endcannot value="edit-files" />
<strong>@lang('server.users.new.edit_files.title')</strong>
<p class="text-muted small">@lang('server.users.new.edit_files.description')</p>
</div>
<div>
<input name="permissions[]" type="checkbox" @if(isset($permissions['save-files']))checked="checked"@endif @cannot('edit-subuser', $server)disabled="disabled"@endcannot value="save-files" />
<strong>@lang('server.users.new.save_files.title')</strong>
<p class="text-muted small">@lang('server.users.new.save_files.description')</p>
</div>
<div>
<input name="permissions[]" type="checkbox" @if(isset($permissions['move-files']))checked="checked"@endif @cannot('edit-subuser', $server)disabled="disabled"@endcannot value="move-files" />
<strong>@lang('server.users.new.move_files.title')</strong>
<p class="text-muted small">@lang('server.users.new.move_files.description')</p>
</div>
<div>
<input name="permissions[]" type="checkbox" @if(isset($permissions['copy-files']))checked="checked"@endif @cannot('edit-subuser', $server)disabled="disabled"@endcannot value="copy-files" />
<strong>@lang('server.users.new.copy_files.title')</strong>
<p class="text-muted small">@lang('server.users.new.copy_files.description')</p>
</div>
<div>
<input name="permissions[]" type="checkbox" @if(isset($permissions['compress-files']))checked="checked"@endif @cannot('edit-subuser', $server)disabled="disabled"@endcannot value="compress-files" />
<strong>@lang('server.users.new.compress_files.title')</strong>
<p class="text-muted small">@lang('server.users.new.compress_files.description')</p>
</div>
<div>
<input name="permissions[]" type="checkbox" @if(isset($permissions['decompress-files']))checked="checked"@endif @cannot('edit-subuser', $server)disabled="disabled"@endcannot value="decompress-files" />
<strong>@lang('server.users.new.decompress_files.title')</strong>
<p class="text-muted small">@lang('server.users.new.decompress_files.description')</p>
</div>
<div>
<input name="permissions[]" type="checkbox" @if(isset($permissions['create-files']))checked="checked"@endif @cannot('edit-subuser', $server)disabled="disabled"@endcannot value="create-files" />
<strong>@lang('server.users.new.create_files.title')</strong>
<p class="text-muted small">@lang('server.users.new.create_files.description')</p>
</div>
<div>
<input name="permissions[]" type="checkbox" @if(isset($permissions['upload-files']))checked="checked"@endif @cannot('edit-subuser', $server)disabled="disabled"@endcannot value="upload-files" />
<strong>@lang('server.users.new.upload_files.title')</strong>
<p class="text-muted small">@lang('server.users.new.upload_files.description')</p>
</div>
<div>
<input name="permissions[]" type="checkbox" @if(isset($permissions['delete-files']))checked="checked"@endif @cannot('edit-subuser', $server)disabled="disabled"@endcannot value="delete-files" />
<span class="label label-danger">@lang('strings.danger')</span>
<strong>@lang('server.users.new.delete_files.title')</strong>
<p class="text-muted small">@lang('server.users.new.delete_files.description')</p>
</div>
<div>
<input name="permissions[]" type="checkbox" @if(isset($permissions['download-files']))checked="checked"@endif @cannot('edit-subuser', $server)disabled="disabled"@endcannot value="download-files" />
<span class="label label-danger">@lang('strings.danger')</span>
<strong>@lang('server.users.new.download_files.title')</strong>
<p class="text-muted small">@lang('server.users.new.download_files.description')</p>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">@lang('server.users.new.task_header')</h3>
</div>
<div class="box-body">
<div>
<input name="permissions[]" type="checkbox" @if(isset($permissions['list-tasks']))checked="checked"@endif @cannot('edit-subuser', $server)disabled="disabled"@endcannot value="list-tasks" />
<strong>@lang('server.users.new.list_tasks.title')</strong>
<p class="text-muted small">@lang('server.users.new.list_tasks.description')</p>
</div>
<div>
<input name="permissions[]" type="checkbox" @if(isset($permissions['view-task']))checked="checked"@endif @cannot('edit-subuser', $server)disabled="disabled"@endcannot value="view-task" />
<strong>@lang('server.users.new.view_task.title')</strong>
<p class="text-muted small">@lang('server.users.new.view_task.description')</p>
</div>
<div>
<input name="permissions[]" type="checkbox" @if(isset($permissions['toggle-task']))checked="checked"@endif @cannot('edit-subuser', $server)disabled="disabled"@endcannot value="toggle-task" />
<strong>@lang('server.users.new.toggle_task.title')</strong>
<p class="text-muted small">@lang('server.users.new.toggle_task.description')</p>
</div>
<div>
<input name="permissions[]" type="checkbox" @if(isset($permissions['queue-task']))checked="checked"@endif @cannot('edit-subuser', $server)disabled="disabled"@endcannot value="queue-task" />
<strong>@lang('server.users.new.queue_task.title')</strong>
<p class="text-muted small">@lang('server.users.new.queue_task.description')</p>
</div>
<div>
<input name="permissions[]" type="checkbox" @if(isset($permissions['create-task']))checked="checked"@endif @cannot('edit-subuser', $server)disabled="disabled"@endcannot value="create-task" />
<strong>@lang('server.users.new.create_task.title')</strong>
<p class="text-muted small">@lang('server.users.new.create_task.description')</p>
</div>
<div>
<input name="permissions[]" type="checkbox" @if(isset($permissions['delete-task']))checked="checked"@endif @cannot('edit-subuser', $server)disabled="disabled"@endcannot value="delete-task" />
<span class="label label-danger">@lang('strings.danger')</span>
<strong>@lang('server.users.new.delete_task.title')</strong>
<p class="text-muted small">@lang('server.users.new.delete_task.description')</p>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">@lang('server.users.new.db_header')</h3>
</div>
<div class="box-body">
<div>
<input name="permissions[]" type="checkbox" @if(isset($permissions['view-databases']))checked="checked"@endif @cannot('edit-subuser', $server)disabled="disabled"@endcannot value="view-databases" />
<span class="label label-danger">@lang('strings.danger')</span>
<strong>@lang('server.users.new.view_databases.title')</strong>
<p class="text-muted small">@lang('server.users.new.view_databases.description')</p>
</div>
<div>
<input name="permissions[]" type="checkbox" @if(isset($permissions['reset-db-password']))checked="checked"@endif @cannot('edit-subuser', $server)disabled="disabled"@endcannot value="reset-db-password" />
<span class="label label-danger">@lang('strings.danger')</span>
<strong>@lang('server.users.new.reset_db_password.title')</strong>
<p class="text-muted small">@lang('server.users.new.reset_db_password.description')</p>
</div>
@foreach($perms as $permission => $daemon)
<div class="form-group">
<div class="checkbox checkbox-primary no-margin-bottom">
<input id="{{ $permission }}" name="permissions[]" type="checkbox" @if(isset($permissions['power-start']))checked="checked"@endif @cannot('edit-subuser', $server)disabled="disabled"@endcannot value="{{ $permission }}"/>
<label for="{{ $permission }}" class="strong">
@lang('server.users.new.' . str_replace('-', '_', $permission) . '.title')
</label>
</div>
<p class="text-muted small">@lang('server.users.new.' . str_replace('-', '_', $permission) . '.description')</p>
</div>
@endforeach
</div>
</div>
</div>
@if ($loop->iteration % 2 === 0)
<div class="clearfix visible-lg-block visible-md-block visible-sm-block"></div>
@endif
@endforeach
</div>
@can('edit-subuser', $server)
</form>