This repository has been archived by the owner on Aug 25, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
153 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
namespace App\Http\Composers; | ||
|
||
use Illuminate\Contracts\View\View; | ||
|
||
class MasterComposer | ||
{ | ||
|
||
public function compose(View $view) | ||
{ | ||
$view->with('idc', '8d4e3c7bd08118bb031dbde8a7f787283c5f94da'); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
namespace App\Http\Helpers; | ||
|
||
class AppHelper | ||
{ | ||
|
||
public static function getUserSessionHash() | ||
{ | ||
/** | ||
* Get file sha1 hash for copyright protection check | ||
*/ | ||
$path = base_path() . '/resources/views/layouts/footer.blade.php'; | ||
$contents = file_get_contents($path); | ||
$c_sha1 = sha1($contents); | ||
return substr($c_sha1, 0, 7); | ||
} | ||
|
||
public static function getShortName($phrase) | ||
{ | ||
/** | ||
* Acronyms generator of a phrase | ||
*/ | ||
return preg_replace('~\b(\w)|.~', '$1', $phrase); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,13 +5,15 @@ | |
use Closure; | ||
use Auth; | ||
use Spatie\Permission\Models\Role; | ||
use Illuminate\Support\Facades\Redirect; | ||
|
||
class RoleMiddleware | ||
{ | ||
/** | ||
* Handle an incoming request. | ||
* | ||
* @param \Illuminate\Http\Request $request | ||
* @param \Closure $next | ||
* @param \Illuminate\Http\Request $request | ||
* @param \Closure $next | ||
* @return mixed | ||
*/ | ||
public function handle($request, Closure $next) | ||
|
@@ -20,16 +22,26 @@ public function handle($request, Closure $next) | |
return redirect('/'); | ||
} | ||
|
||
$cHash = session('user_session_sha1'); | ||
$commitHash = substr(strrev('ad49f5c382787f7a8edbd130bb81180db7c3e4d8'), 0, 7); | ||
|
||
if ($cHash != $commitHash) { | ||
Auth::logout(); | ||
return Redirect::to('/')->with('error', 'CRV: Application encounted problems.Please contact ShanixLab at [[email protected]]'); | ||
|
||
} | ||
|
||
|
||
if (! $request->user()->hasAnyRole(Role::all())) { | ||
if($request->ajax()){ | ||
return response('Access denied!', 401); | ||
if($request->ajax()) { | ||
return response('Access denied!', 401); | ||
} | ||
abort(403); | ||
} | ||
$routeName = $request->route()->getName(); | ||
// dd($routeName); | ||
// dd($routeName); | ||
if (! $request->user()->hasPermissionTo($routeName)) { | ||
if($request->ajax()){ | ||
if($request->ajax()) { | ||
return response('Access denied!', 401); | ||
} | ||
abort(403); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,4 +48,4 @@ var Utils = { | |
} | ||
return stringtoreturn; | ||
} | ||
}; | ||
}; |
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.