Skip to content
Open
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
2 changes: 1 addition & 1 deletion app/Console/Commands/ImportSqlDump.php
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ private function runLegacyToNewMapping(string $connection, string $legacyDb, str
'aslab' => array_merge(PermissionGroupEnum::ASLAB, ['manage-pelanggaran']),
'atc' => PermissionGroupEnum::ATC,
'rdc' => PermissionGroupEnum::RDC,
'asisten' => array_values(array_diff(PermissionGroupEnum::ASISTEN, [PermissionGroupEnum::SEE_MODUL])),
'asisten' => PermissionGroupEnum::ASISTEN,
'praktikan' => PermissionGroupEnum::PRAKTIKAN,
];

Expand Down
19 changes: 12 additions & 7 deletions app/Http/Controllers/API/RoleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ public function store(Request $request)
}

switch ($paket) {
// case 'super':
// $permissions = array_merge($permissions, $SUPER_PACKAGE);
// break;
// case 'aslab':
// $permissions = array_merge($permissions, $ASLAB_PACKAGE);
// break;
case 'super':
$permissions = array_merge($permissions, $SUPER_PACKAGE);
break;
case 'aslab':
$permissions = array_merge($permissions, $ASLAB_PACKAGE);
break;
case 'atc':
$permissions = array_merge($permissions, $ATC_PACKAGE);
break;
Expand All @@ -92,13 +92,18 @@ public function store(Request $request)
}
}

// Every asisten role needs manage-profile to land on /assistant after login,
// regardless of which packages were selected (mirrors RolePermissionsSeeder,
// where every seeded role has it).
$permissions[] = PermissionGroupEnum::MANAGE_PROFILE;

$role = Role::create([
'name' => $request->name,
'guard_name' => 'asisten',
'created_at' => now(),
'updated_at' => now(),
]);
$role->syncPermissions($permissions);
$role->syncPermissions(array_unique($permissions));

return redirect(route('manage-role'))->with('success', 'Role created successfully.');
} catch (\Throwable $th) {
Expand Down
3 changes: 0 additions & 3 deletions app/PermissionGroupEnum.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ enum PermissionGroupEnum: string

const MANAGE_MODUL = 'manage-modul';

const SEE_MODUL = 'see-modul';

const MANAGE_SOAL = 'manage-soal';

const UNLOCK_JAWABAN = 'unlock-jawaban';
Expand Down Expand Up @@ -100,7 +98,6 @@ enum PermissionGroupEnum: string
self::MANAGE_PROFILE,
self::SEE_PRAKTIKUM,
self::SEE_HISTORY,
self::SEE_MODUL,
self::SEE_SOAL,
self::NILAI_PRAKTIKAN,
self::SEE_PLOT,
Expand Down
38 changes: 21 additions & 17 deletions resources/js/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,29 @@ window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';

window.Pusher = Pusher;

window.Echo = new Echo({
broadcaster: 'reverb',
key: import.meta.env.VITE_REVERB_APP_KEY,
wsHost: import.meta.env.VITE_REVERB_HOST,
wsPort: import.meta.env.VITE_REVERB_PORT ?? 80,
wssPort: import.meta.env.VITE_REVERB_PORT ?? 443,
forceTLS: (import.meta.env.VITE_REVERB_SCHEME ?? 'https') === 'https',
enabledTransports: ['ws'],
authEndpoint: '/broadcasting/auth',
auth: {
headers: {
'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]')?.getAttribute('content'),
},
},
});
/**
* Echo exposes an expressive API for subscribing to channels and listening
* for events that are broadcast by Laravel. Echo and event broadcasting
* allow your team to quickly build robust real-time web applications.
*
* Only connect when a Reverb key is configured (VITE_REVERB_APP_KEY) so local
* dev without a running Reverb server doesn't spam failed websocket retries.
* Consumers already guard on `window.Echo` being truthy before using it.
*/

import './echo';
if (import.meta.env.VITE_REVERB_APP_KEY) {
window.Echo = new Echo({
broadcaster: 'reverb',
key: import.meta.env.VITE_REVERB_APP_KEY,
wsHost: import.meta.env.VITE_REVERB_HOST,
wsPort: import.meta.env.VITE_REVERB_PORT ?? 80,
wssPort: import.meta.env.VITE_REVERB_PORT ?? 443,
forceTLS: (import.meta.env.VITE_REVERB_SCHEME ?? 'https') === 'https',
enabledTransports: ['ws'],
authEndpoint: '/broadcasting/auth',
auth: {
headers: {
'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]')?.getAttribute('content'),
},
},
});
}
20 changes: 0 additions & 20 deletions resources/js/echo.js

This file was deleted.