Migration vor #11 #12 #13 and hide in app list #11

This commit is contained in:
Kekskurse 2019-04-30 14:55:13 +02:00
parent 997fbbf5ef
commit 910ea317a8
5 changed files with 61 additions and 30 deletions

View file

@ -36,8 +36,15 @@ class AccessController extends Controller
} }
$access = AppAccess::query()->where("user_id", "=", Auth::user()->id)->get(); $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) { public function removeAccess(Request $request) {

View file

@ -100,6 +100,7 @@ class AdminController extends Controller
$app->testing_warning = (bool)$request->input("testing_warning", false); $app->testing_warning = (bool)$request->input("testing_warning", false);
$app->untrusted_warning = (bool)$request->input("untrusted_warning", false); $app->untrusted_warning = (bool)$request->input("untrusted_warning", false);
$app->show_on_webpage = (bool)$request->input("show_on_webpage", 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->saveOrFail();
$app = App::query()->where("id", "=", $id)->first("*"); $app = App::query()->where("id", "=", $id)->first("*");

View file

@ -26,6 +26,7 @@ class AppController extends Controller
abort(401); abort(401);
} }
$apps = App::query()->where("user_id", "=", Auth::user()->id)->get(); $apps = App::query()->where("user_id", "=", Auth::user()->id)->get();
return view('app/list', ["msg"=>"", "apps" => $apps]); return view('app/list', ["msg"=>"", "apps" => $apps]);
} }
public function newAppView() { public function newAppView() {

View file

@ -0,0 +1,44 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AppSettingsHiddenAndStopRedirect extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('apps', function (Blueprint $table) {
$table->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');
});
}
}

View file

@ -13,35 +13,6 @@
<th>Beschreibung</th> <th>Beschreibung</th>
<th>Value</th> <th>Value</th>
</tr> </tr>
<!--<tr>
<td>Status</td>
<td colspan="2">
<select name="status" class="form-control">
<option <?php if($app->status == "active" ) { echo "selected='selected'"; } ?>>active</option>
<option <?php if($app->status == "testing" ) { echo "selected='selected'"; } ?>>testing</option>
<option <?php if($app->status == "deactivate" ) { echo "selected='selected'"; } ?>>deactivate</option>
</select>
</td>
</tr>
<tr>
<td>Trust Level</td>
<td colspan="2">
<select name="trustLevel" class="form-control">
<option <?php if($app->trustLevel == "full-trustet" ) { echo "selected='selected'"; } ?>>full-trustet</option>
<option <?php if($app->trustLevel == "trustet" ) { echo "selected='selected'"; } ?>>trustet</option>
<option <?php if($app->trustLevel == "untrustet" ) { echo "selected='selected'"; } ?>>untrustet</option>
</select>
</td>
</tr>
<tr>
<td>Owner</td>
<td colspan="2">
<select name="owner" class="form-control">
<option <?php if($app->owner == "user" ) { echo "selected='selected'"; } ?>>user</option>
<option <?php if($app->owner == "system" ) { echo "selected='selected'"; } ?>>system</option>
</select>
</td>
</tr>!-->
<tr> <tr>
<td>Auto Accept</td> <td>Auto Accept</td>
<td>User dont have to click login, if the user is logged in he/she will immediately redirected back.</td> <td>User dont have to click login, if the user is logged in he/she will immediately redirected back.</td>
@ -70,6 +41,13 @@
<input name="show_on_webpage" type="checkbox" <?php if($app->show_on_webpage) { echo 'checked="checked"'; } ?>> <input name="show_on_webpage" type="checkbox" <?php if($app->show_on_webpage) { echo 'checked="checked"'; } ?>>
</td> </td>
</tr> </tr>
<tr>
<td>Hide in App list</td>
<td>User cant see this App in his app list</td>
<td>
<input name="hidden_in_app_list" type="checkbox" <?php if($app->hidden_in_app_list) { echo 'checked="checked"'; } ?>>
</td>
</tr>
</table> </table>
<input type="submit" class="btn btn-warning" value="Save"> <input type="submit" class="btn btn-warning" value="Save">
</form> </form>