Disabled remove access button #11

This commit is contained in:
Kekskurse 2019-04-30 14:59:28 +02:00
parent 910ea317a8
commit 1e604ae8a3
4 changed files with 20 additions and 1 deletions

View file

@ -57,6 +57,10 @@ class AccessController extends Controller
abort(401); abort(401);
} }
if($access->getApp()->user_cant_remove_app) {
abort(400, "App access cant remove for this app");
}
RefreshToken::query()->where("access_id", "=", $access->id)->delete(); RefreshToken::query()->where("access_id", "=", $access->id)->delete();
\App\Models\AccessToken::query()->where("access_id", "=", $access->id)->delete(); \App\Models\AccessToken::query()->where("access_id", "=", $access->id)->delete();
AppCode::query()->where("access_id", "=", $access->id)->delete(); AppCode::query()->where("access_id", "=", $access->id)->delete();

View file

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

View file

@ -17,7 +17,14 @@
<td><?php echo $a->getApp()->name; ?></td> <td><?php echo $a->getApp()->name; ?></td>
<td><?php echo $a->getApp()->description; ?></td> <td><?php echo $a->getApp()->description; ?></td>
<td><?php echo $a->created_at->format("d.m.Y H:i"); ?></td> <td><?php echo $a->created_at->format("d.m.Y H:i"); ?></td>
<td style="text-align: right"><a href="/gui/access/rm?id=<?php echo $a->id; ?>" class="btn btn-danger btn-sm">Remove Access</a> </td> <td style="text-align: right">
<?php
if(!$a->getApp()->user_cant_remove_app) {
echo '<a href="/gui/access/rm?id=<?php echo $a->id; ?>" class="btn btn-danger btn-sm">Remove Access</a>';
}
?>
</td>
</tr> </tr>
<?php <?php
} }

View file

@ -48,6 +48,13 @@
<input name="hidden_in_app_list" type="checkbox" <?php if($app->hidden_in_app_list) { echo 'checked="checked"'; } ?>> <input name="hidden_in_app_list" type="checkbox" <?php if($app->hidden_in_app_list) { echo 'checked="checked"'; } ?>>
</td> </td>
</tr> </tr>
<tr>
<td>Disable remove Access</td>
<td>User can't remove Access to this App in the AppList</td>
<td>
<input name="user_cant_remove_app" type="checkbox" <?php if($app->user_cant_remove_app) { 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>