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

Rilis v2308.0.0 #228

Merged
merged 20 commits into from
Aug 1, 2023
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
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ LOG_LEVEL=debug
# default connection ke database utama
DB_CONNECTION=mysql

# database utama aplikasi openkab
# database utama aplikasi OpenKab
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=openkab
Expand Down
20 changes: 2 additions & 18 deletions app/Enums/Modul.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,8 @@
*/
final class Modul extends Enum
{
const Data = [
'wilayah',
'kependudukan',
'penduduk',
'dokumen',
'bantuan',
'statistik',
'statistik-penduduk',
'statistik-keluarga',
'statistik-rtm',
'statistik-bantuan',
'master-data',
'master-data-bantuan',
'master-data-artikel',
'master-data-pengaturan',
'pengaturan',
'pengaturan-identitas',
'pengaturan-users',
const permision = [
'read', 'write', 'edit', 'delete',
];

const Menu = [
Expand Down
2 changes: 1 addition & 1 deletion app/Helpers/general.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/
function openkab_versi()
{
return 'v2307.0.0';
return 'v2308.0.0';
}
}

Expand Down
65 changes: 65 additions & 0 deletions app/Http/Controllers/Api/PermisionController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?php

namespace App\Http\Controllers\Api;

use Illuminate\Http\Request;
use Spatie\Permission\Contracts\Role;

class PermisionController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
//
}

/**
* Store a newly created resource in storage.
*
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
//
}

/**
* Display the specified resource.
*
* @param int $id
*
* @return \Illuminate\Http\Response
*/
public function show($id)
{
// $role = Role::where
}

/**
* Update the specified resource in storage.
*
* @param int $id
*
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
//
}

/**
* Remove the specified resource from storage.
*
* @param int $id
*
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
//
}
}
2 changes: 1 addition & 1 deletion app/Http/Controllers/Api/TeamController.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public function update(Request $request, $id)

public function show($id)
{
return $this->fractal($this->team->listTeam()->where('id', $id)->first(), function ($team) {
return $this->fractal($this->team->listTeam()->with(['role', 'role.permissions'])->where('id', $id)->first(), function ($team) {
return $team->toArray();
}, 'team')->respond();
}
Expand Down
7 changes: 6 additions & 1 deletion app/Http/Controllers/DasborController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,15 @@

namespace App\Http\Controllers;

use App\Models\Identitas;

class DasborController extends Controller
{
public function index()
{
return view('dasbor.index');
$identitas = new Identitas();
$data = $identitas->pengaturan();

return view('dasbor.index', compact('data'));
}
}
11 changes: 10 additions & 1 deletion app/Http/Controllers/GroupController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,18 @@

class GroupController extends Controller
{
private $nama_aplikasi;

public function __construct()
{
$this->nama_aplikasi = 'Group '.config('app.namaAplikasi');
}

public function index()
{
return view('group.index');
return view('group.index', [
'nama_aplikasi' => $this->nama_aplikasi,
]);
}

public function create()
Expand Down
20 changes: 20 additions & 0 deletions app/Models/Identitas.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,24 @@
class Identitas extends Model
{
use HasFactory;

protected $table = 'identitas';

protected $fillable = [
'nama_aplikasi', 'deskripsi', 'favicon',
'logo', 'nama_kabupaten', 'kode_kabupaten',
'nama_provinsi', 'kode_provinsi', 'sebutan_kab',
];

public static function pengaturan()
{
$identitas = self::first();

$data['nama_aplikasi'] = $identitas->nama_aplikasi ?? config('app.namaAplikasi');
$data['sebutanKab'] = $identitas->sebutan_kab ?? config('app.sebutanKab');
$nama_kabupaten = preg_replace('/KAB/', '', $identitas->nama_kabupaten) ?? config('app.namaKab');
$data['nama_kabupaten'] = strtolower($data['sebutanKab']) == 'kota' ? $nama_kabupaten : $data['sebutanKab'].' '.$nama_kabupaten;

return $data;
}
}
11 changes: 11 additions & 0 deletions app/Models/Permision.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Permision extends Model
{
use HasFactory;
}
7 changes: 7 additions & 0 deletions app/Models/Team.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Spatie\Permission\Models\Role;

class Team extends Model
{
Expand All @@ -26,4 +28,9 @@ class Team extends Model
protected $casts = [
'menu' => 'json',
];

public function role(): HasMany
{
return $this->hasMany(Role::class, 'team_id', 'id');
}
}
13 changes: 13 additions & 0 deletions catatan_rilis.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Di rilis v2308.0.0 berisi penambahan fitur dan perbaikan lain sesuai dengan pelayanan ke pelanggan.

#### Penambahan Fitur

1. [#198](https://github.com/OpenSID/OpenKab/issues/198) Sediakan API untuk manajemen hak akses pengguna OpenKab.

#### Perbaikan BUG

1. [#206](https://github.com/OpenSID/OpenKab/issues/206) Perbaikan filter pada bantuan tidak berjalan.
2. [#219](https://github.com/OpenSID/OpenKab/issues/219) Perbaikan hilangkan url pada widget keluarga dan rtm.
3. [#218](https://github.com/OpenSID/OpenKab/issues/218) Perbaikan Sambutan selamat datang tidak sesuai dengan pengaturan.
4. [#220](https://github.com/OpenSID/OpenKab/issues/220) Perbaikan hilangkan duplikat seeder.
5. [#226](https://github.com/OpenSID/OpenKab/issues/226) Perbaikan semua penamaan OpenKAB menjadi OpenKab.
4 changes: 2 additions & 2 deletions config/adminlte.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
|
*/

'title' => 'OpenKAB',
'title' => 'OpenKab',
'title_prefix' => '',
'title_postfix' => '',

Expand Down Expand Up @@ -68,7 +68,7 @@
'logo_img_class' => 'brand-image elevation-3',
'logo_img_xl' => null,
'logo_img_xl_class' => 'brand-image-xs',
'logo_img_alt' => 'OpenKAB',
'logo_img_alt' => 'OpenKab',

/*
|--------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
Expand All @@ -26,6 +27,11 @@ public function up()
$table->string('sebutan_kab', 100);
$table->timestamps();
});

Artisan::call('db:seed', [
'--class' => 'IdentitasSeeder',
'--force' => true,
]);
}

/**
Expand Down
30 changes: 0 additions & 30 deletions database/migrations/2023_05_04_180525_seed_identitas.php

This file was deleted.

18 changes: 16 additions & 2 deletions database/migrations/2023_06_13_073258_create_role.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,29 @@ public function up()
'id_team' => $team->id,
]);

foreach (Modul::Data as $value) {
foreach (Modul::Menu as $main_menu) {
// buat role
$role = Role::create(
[
'name' => $value,
'name' => $main_menu['role'],
'team_id' => $team->id,
'guard_name' => 'web',
]
);
$user->assignRole($role->id);

if (isset($main_menu['submenu'])) {
foreach ($main_menu['submenu'] as $sub_menu) {
$role = Role::create(
[
'name' => $sub_menu['role'],
'team_id' => $team->id,
'guard_name' => 'web',
]
);
$user->assignRole($role->id);
}
}
}
}

Expand Down
56 changes: 56 additions & 0 deletions database/migrations/2023_06_21_190927_permision.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?php

use App\Enums\Modul;
use Illuminate\Database\Migrations\Migration;
use Spatie\Permission\Models\Permission;
use Spatie\Permission\Models\Role;

return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
$roles = Role::get();

foreach (Modul::Menu as $main_menu) {
// buat role

$roles = Role::where('name', $main_menu['role'])->get();

foreach (Modul::permision as $permision) {
$name_permision = $main_menu['role'].'-'.$permision;
$permision = Permission::create(['name' => $name_permision]);
foreach ($roles as $role) {
$role->givePermissionTo($name_permision);
}
}

if (isset($main_menu['submenu'])) {
foreach ($main_menu['submenu'] as $sub_menu) {
$roles = Role::where('name', $sub_menu['role'])->get();
foreach (Modul::permision as $permision) {
$name_permision = $sub_menu['role'].'-'.$permision;
Permission::create(['name' => $name_permision]);
foreach ($roles as $role) {
$role->givePermissionTo($name_permision);
}
}
}
}
}
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
};
5 changes: 1 addition & 4 deletions database/seeders/DatabaseSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ class DatabaseSeeder extends Seeder
*/
public function run()
{
$this->call([
CreateAdminUserSeeder::class,
IdentitasSeeder::class,
]);
//
}
}
Loading