From 910ea317a8439ba8126e075f2adf1a4edc0bf88f Mon Sep 17 00:00:00 2001 From: Kekskurse Date: Tue, 30 Apr 2019 14:55:13 +0200 Subject: [PATCH] Migration vor #11 #12 #13 and hide in app list #11 --- app/Http/Controllers/GUI/AccessController.php | 9 +++- app/Http/Controllers/GUI/AdminController.php | 1 + app/Http/Controllers/GUI/AppController.php | 1 + ..._app_settings_hidden_and_stop_redirect.php | 44 +++++++++++++++++++ resources/views/admin/app_details.php | 36 +++------------ 5 files changed, 61 insertions(+), 30 deletions(-) create mode 100644 database/migrations/2019_04_30_124109_app_settings_hidden_and_stop_redirect.php diff --git a/app/Http/Controllers/GUI/AccessController.php b/app/Http/Controllers/GUI/AccessController.php index ee598c6..559067d 100644 --- a/app/Http/Controllers/GUI/AccessController.php +++ b/app/Http/Controllers/GUI/AccessController.php @@ -36,8 +36,15 @@ class AccessController extends Controller } $access = AppAccess::query()->where("user_id", "=", Auth::user()->id)->get(); + $visibleAccess = []; + foreach($access as $a) { + if(!$a->getApp()->hidden_in_app_list) { + $visibleAccess[] = $a; + } + } - return view("access/list", ["access" => $access]); + + return view("access/list", ["access" => $visibleAccess]); } public function removeAccess(Request $request) { diff --git a/app/Http/Controllers/GUI/AdminController.php b/app/Http/Controllers/GUI/AdminController.php index 8781a44..f3f1f9f 100644 --- a/app/Http/Controllers/GUI/AdminController.php +++ b/app/Http/Controllers/GUI/AdminController.php @@ -100,6 +100,7 @@ class AdminController extends Controller $app->testing_warning = (bool)$request->input("testing_warning", false); $app->untrusted_warning = (bool)$request->input("untrusted_warning", false); $app->show_on_webpage = (bool)$request->input("show_on_webpage", false); + $app->hidden_in_app_list = (bool)$request->input("hidden_in_app_list", false); $app->saveOrFail(); $app = App::query()->where("id", "=", $id)->first("*"); diff --git a/app/Http/Controllers/GUI/AppController.php b/app/Http/Controllers/GUI/AppController.php index d805982..c57df5a 100644 --- a/app/Http/Controllers/GUI/AppController.php +++ b/app/Http/Controllers/GUI/AppController.php @@ -26,6 +26,7 @@ class AppController extends Controller abort(401); } $apps = App::query()->where("user_id", "=", Auth::user()->id)->get(); + return view('app/list', ["msg"=>"", "apps" => $apps]); } public function newAppView() { diff --git a/database/migrations/2019_04_30_124109_app_settings_hidden_and_stop_redirect.php b/database/migrations/2019_04_30_124109_app_settings_hidden_and_stop_redirect.php new file mode 100644 index 0000000..364670b --- /dev/null +++ b/database/migrations/2019_04_30_124109_app_settings_hidden_and_stop_redirect.php @@ -0,0 +1,44 @@ +boolean('stop_auto_redirect')->default(false)->comment('The user must always click the redirect button, auto redirect dont work any more'); + $table->boolean('hidden_in_app_list')->default(false)->comment('Hide the App in the Users App list'); + $table->boolean('user_cant_remove_app')->default(false)->comment('User see the App in the App list but cant remove it'); + }); + + Schema::table('users', function (Blueprint $table) { + $table->string('password_recovery_code')->nullable()->default(null)->comment('Token to reset the password if lost'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('apps', function (Blueprint $table) { + $table->dropColumn('stop_auto_redirect'); + $table->dropColumn('hidden_in_app_list'); + $table->dropColumn('user_cant_remove_app'); + }); + Schema::table('users', function (Blueprint $table) { + $table->dropColumn('password_recovery_code')->nullable()->default(null)->comment('Token to reset the password if lost'); + }); + + } +} diff --git a/resources/views/admin/app_details.php b/resources/views/admin/app_details.php index 3616c42..dabad75 100644 --- a/resources/views/admin/app_details.php +++ b/resources/views/admin/app_details.php @@ -13,35 +13,6 @@ Beschreibung Value - Auto Accept User dont have to click login, if the user is logged in he/she will immediately redirected back. @@ -70,6 +41,13 @@ show_on_webpage) { echo 'checked="checked"'; } ?>> + + Hide in App list + User cant see this App in his app list + + hidden_in_app_list) { echo 'checked="checked"'; } ?>> + +