update
parent
5fd898ce44
commit
414a2817b7
|
@ -630,6 +630,11 @@ if (!function_exists('permission')) {
|
|||
$query = count(array_intersect((array)$access, (array)$model->access));
|
||||
} else {
|
||||
$query = MasterAccessMenu::where($access, true)->where('module', 'LIKE', $key.'%')->where('ms_group_id', session('group_id'))->count();
|
||||
if ($query > 0) {
|
||||
return true;
|
||||
} else {
|
||||
return abort('401');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$query = MasterAccessMenu::where($access, true)->where('ms_menu_id', $key)->where('ms_group_id', session('group_id'))->count();
|
||||
|
|
|
@ -19,8 +19,8 @@ class KuesionerController extends Controller
|
|||
public function index()
|
||||
{
|
||||
permission('is_read', $this->route, 'module',true);
|
||||
if(auth()->user()->group->alias != 'administrator'){
|
||||
return redirect('kuesioner/update');
|
||||
if(auth()->user()->group->alias == 'sekolah'){
|
||||
return redirect('kuesioner/update/'.encode_id(session('sekolah_id')));
|
||||
}
|
||||
|
||||
$data['provinsi'] = Provinsi::where('kode_wilayah','010000')->get();
|
||||
|
|
|
@ -17,6 +17,7 @@ class RoleController extends Controller
|
|||
*/
|
||||
public function index()
|
||||
{
|
||||
permission('is_read', $this->route, 'module',true);
|
||||
$data['breadcrumbs'] = [
|
||||
['name' => 'Dashboard','url' => url('dashboard')],
|
||||
['name' => 'Management & Akses Role'],
|
||||
|
|
|
@ -23,6 +23,8 @@ class UserController extends Controller
|
|||
*/
|
||||
public function index()
|
||||
{
|
||||
permission('is_read', $this->route, 'module',true);
|
||||
|
||||
$data['breadcrumbs'] = [
|
||||
['name' => 'Dashboard','url' => url('dashboard')],
|
||||
['name' => 'Management & Akses Role'],
|
||||
|
@ -48,6 +50,7 @@ class UserController extends Controller
|
|||
if((permission('is_create', $this->route.'.*','module',false)) || (permission('is_update', $this->route.'.*','module',false))){
|
||||
$action .= '<a href="'.url('management/user/update/'.encode_id($row->id)).'" data-toggle="tooltip" title="Edit Data" class="btn btn-xs btn-block btn-primary"><i class="fal fa-pencil text-white"></i></a>';
|
||||
if(session('group_id') == 1){
|
||||
$action .= '<a href="#" data-href="'.url('management/user/forcelogin/'.encode_id($row->id)).'" data-toggle="tooltip" title="Force Login" class="forcelogin btn btn-xs btn-block btn-success"><i class="fal fa-user text-white"></i></a>';
|
||||
$action .= '<a href="#" data-href="'.url('management/user/delete/'.encode_id($row->id)).'" data-toggle="tooltip" title="Edit Data" class="remove_data btn btn-xs btn-block btn-danger"><i class="fal fa-trash text-white"></i></a>';
|
||||
}
|
||||
}
|
||||
|
@ -197,4 +200,53 @@ class UserController extends Controller
|
|||
|
||||
return response()->json(['success' => true,'message' => 'Berhasil update data','type' => 'success']);
|
||||
}
|
||||
|
||||
public function forcelogin($id = null)
|
||||
{
|
||||
|
||||
//dd($id);
|
||||
|
||||
if (!$id) {
|
||||
return response()->json(['success' => false,'message' => 'Data Tidak Temukan','type' => 'error']);
|
||||
}
|
||||
|
||||
$id = decode_id($id);
|
||||
$user = User::find($id);
|
||||
if (!$user) {
|
||||
return response()->json(['success' => false,'message' => 'Data Tidak Temukan','type' => 'error']);
|
||||
} else {
|
||||
|
||||
if ($user->username && $user->password) {
|
||||
if (Auth::loginUsingId($id)) {
|
||||
$session = [
|
||||
'username' => $user->username,
|
||||
'name' => $user->name,
|
||||
'email' => $user->email,
|
||||
'sekolah_id' => @$user->profile->sekolah->MsSekolahId,
|
||||
'npsn' => @$user->profile->npsn,
|
||||
'tingkat_sekolah' => @$user->profile->tingkat->name,
|
||||
'status_sekolah' => @$user->profile->status_sekolah,
|
||||
'alamat_sekolah' => @$user->profile->alamat_sekolah,
|
||||
'kontak_person' => @$user->profile->kontak_person,
|
||||
'telp' => @$user->profile->telp,
|
||||
'currYear' => date('Y'),
|
||||
'group_id' => @$user->ms_group_id,
|
||||
'group_alias' => @$user->group->alias,
|
||||
'group_name' => @$user->group->name,
|
||||
];
|
||||
// $this->repository->updateById($user->user_id,['last_login' => Carbon::now(), 'is_online' => session_id()]);
|
||||
session($session);
|
||||
// logActivity($request, __('strings.backend.logs.login_success',['name' => $user->username]));
|
||||
|
||||
return response()->json(['status' => true,'message' => 'Selamat datang kembali','type' => 'success']);
|
||||
}
|
||||
else {
|
||||
|
||||
return response()->json(['status' => false,'message' => 'Maaf Terjadi Kesalahan','type' => 'error']);
|
||||
}
|
||||
} else {
|
||||
return response()->json(['status' => false,'message' => 'Maaf Terjadi Kesalahan','type' => 'error']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>
|
||||
Halaman Tidak Ditemukan
|
||||
</title>
|
||||
<meta name="description" content="Big Error">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no, user-scalable=no, minimal-ui">
|
||||
<!-- Call App Mode on ios devices -->
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
<!-- Remove Tap Highlight on Windows Phone IE -->
|
||||
<meta name="msapplication-tap-highlight" content="no">
|
||||
<!-- base css -->
|
||||
<link rel="stylesheet" media="screen, print" href="{{asset('assets/css/vendors.bundle.css')}}">
|
||||
<link rel="stylesheet" media="screen, print" href="{{asset('assets/css/app.bundle.css')}}">
|
||||
<!-- Place favicon.ico in the root directory -->
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="https://banksampah.jakarta.go.id/images/logo-dinas.ico">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="https://banksampah.jakarta.go.id/images/logo-dinas.ico">
|
||||
<link rel="mask-icon" href="https://banksampah.jakarta.go.id/images/logo-dinas.ico" color="#5bbad5">
|
||||
<!-- Optional: page related CSS-->
|
||||
</head>
|
||||
<body>
|
||||
<!-- BEGIN Page Wrapper -->
|
||||
<div class="page-wrapper alt">
|
||||
<!-- BEGIN Page Content -->
|
||||
<!-- the #js-page-content id is needed for some plugins to initialize -->
|
||||
<main id="js-page-content" role="main" class="page-content">
|
||||
<div class="h-alt-f d-flex flex-column align-items-center justify-content-center text-center">
|
||||
<h1 class="page-error color-fusion-500">
|
||||
<span class="text-danger">ERROR 401</span>
|
||||
<small class="fw-500">
|
||||
Anda Tidak Memiliki Hak Akses Untuk Menu Ini
|
||||
</small>
|
||||
</h1>
|
||||
<a href="{{url('/')}}" class="btn btn-primary"><i class="fal fa-arrow-left"></i> Kembali Ke Halaman Utama</a>
|
||||
</div>
|
||||
</main>
|
||||
<!-- END Page Content -->
|
||||
<!-- BEGIN Page Footer -->
|
||||
<footer class="page-footer" role="contentinfo">
|
||||
<div class="d-flex align-items-center flex-1 text-muted">
|
||||
<span class="hidden-md-down fw-700">{{date('Y')}} © Dinas Lingkungan Hidup Provinsi DKI Jakarta</span>
|
||||
</div>
|
||||
</footer>
|
||||
<!-- END Page Footer -->
|
||||
</div>
|
||||
<script src="{{asset('assets/js/vendors.bundle.js')}}"></script>
|
||||
<script src="{{asset('assets/js/app.bundle.js')}}"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,52 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>
|
||||
Halaman Tidak Ditemukan
|
||||
</title>
|
||||
<meta name="description" content="Big Error">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no, user-scalable=no, minimal-ui">
|
||||
<!-- Call App Mode on ios devices -->
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
<!-- Remove Tap Highlight on Windows Phone IE -->
|
||||
<meta name="msapplication-tap-highlight" content="no">
|
||||
<!-- base css -->
|
||||
<link rel="stylesheet" media="screen, print" href="{{asset('assets/css/vendors.bundle.css')}}">
|
||||
<link rel="stylesheet" media="screen, print" href="{{asset('assets/css/app.bundle.css')}}">
|
||||
<!-- Place favicon.ico in the root directory -->
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="https://banksampah.jakarta.go.id/images/logo-dinas.ico">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="https://banksampah.jakarta.go.id/images/logo-dinas.ico">
|
||||
<link rel="mask-icon" href="https://banksampah.jakarta.go.id/images/logo-dinas.ico" color="#5bbad5">
|
||||
<!-- Optional: page related CSS-->
|
||||
</head>
|
||||
<body>
|
||||
<!-- BEGIN Page Wrapper -->
|
||||
<div class="page-wrapper alt">
|
||||
<!-- BEGIN Page Content -->
|
||||
<!-- the #js-page-content id is needed for some plugins to initialize -->
|
||||
<main id="js-page-content" role="main" class="page-content">
|
||||
<div class="h-alt-f d-flex flex-column align-items-center justify-content-center text-center">
|
||||
<h1 class="page-error color-fusion-500">
|
||||
<span class="text-danger">ERROR 404</span>
|
||||
<small class="fw-500">
|
||||
Halaman Tidak Ditemukan
|
||||
</small>
|
||||
</h1>
|
||||
<a href="{{url('/')}}" class="btn btn-primary"><i class="fal fa-arrow-left"></i> Kembali Ke Halaman Utama</a>
|
||||
</div>
|
||||
</main>
|
||||
<!-- END Page Content -->
|
||||
<!-- BEGIN Page Footer -->
|
||||
<footer class="page-footer" role="contentinfo">
|
||||
<div class="d-flex align-items-center flex-1 text-muted">
|
||||
<span class="hidden-md-down fw-700">{{date('Y')}} © Dinas Lingkungan Hidup Provinsi DKI Jakarta</span>
|
||||
</div>
|
||||
</footer>
|
||||
<!-- END Page Footer -->
|
||||
</div>
|
||||
<script src="{{asset('assets/js/vendors.bundle.js')}}"></script>
|
||||
<script src="{{asset('assets/js/app.bundle.js')}}"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -66,6 +66,49 @@
|
|||
@endsection
|
||||
@section('page-js')
|
||||
<script type="text/javascript">
|
||||
$("#grid-data").on("click", ".forcelogin", function() {
|
||||
var base_url = $(this).attr('data-href');
|
||||
var id = $(this).attr('data-id');
|
||||
swal({
|
||||
title: "Force Login!",
|
||||
text: "Apa anda yakin ingin login sebagai akun ini ?",
|
||||
type: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#3F7D58",
|
||||
confirmButtonText: "Ya Masuk Sekarang",
|
||||
cancelButtonText: "Tidak",
|
||||
closeOnConfirm: true,
|
||||
closeOnCancel: true
|
||||
},
|
||||
function(isConfirm) {
|
||||
if(isConfirm){
|
||||
|
||||
request = $.ajax({
|
||||
url: base_url,
|
||||
type: "GET",
|
||||
});
|
||||
|
||||
// Callback handler that will be called on success
|
||||
request.done(function(response, textStatus, jqXHR){
|
||||
console.log(response);
|
||||
toastr.success("Berhasil Login", 'Berhasil!', {positionClass: 'toast-bottom-right', containerId: 'toast-bottom-right'});
|
||||
window.location.href = '{{url("/dashboard")}}';
|
||||
history.pushState(null, null, location.href);
|
||||
window.onpopstate = function () {
|
||||
history.go(1);
|
||||
};
|
||||
});
|
||||
|
||||
// Callback handler that will be called on failure
|
||||
request.fail(function (jqXHR, textStatus, errorThrown){
|
||||
toastr.error(
|
||||
"Gagal "+textStatus, errorThrown
|
||||
);
|
||||
});
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
$("#grid-data").on("click", ".remove_data", function() {
|
||||
var base_url = $(this).attr('data-href');
|
||||
var id = $(this).attr('data-id');
|
||||
|
|
|
@ -121,10 +121,6 @@
|
|||
<div class="panel-container show">
|
||||
<div class="panel-content">
|
||||
<div id="toolbar">
|
||||
|
||||
<button id="btn-add" class="btn btn-primary">
|
||||
<i class="fal fa-plus"></i> Tambah Data
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<table class="table table-bordered table-hover table-striped w-100"
|
||||
|
|
|
@ -71,6 +71,7 @@ Route::name('management.')->prefix('management')->group(function () {
|
|||
Route::get('grid',[UserController::class,'grid'])->name('grid');
|
||||
Route::get('update/{id?}',[UserController::class,'update'])->name('update');
|
||||
Route::get('delete/{id?}',[UserController::class,'delete'])->name('delete');
|
||||
Route::get('forcelogin/{id?}',[UserController::class,'forcelogin'])->name('forcelogin');
|
||||
});
|
||||
|
||||
Route::name('user_sekolah.')->prefix('user_sekolah')->group(function () {
|
||||
|
|
Loading…
Reference in New Issue