<?php

use MintyPHP\Support\Guard;
use MintyPHP\Router;

Guard::requireLogin();

$user = $_SESSION['user'] ?? [];
$uuid = trim((string) ($user['uuid'] ?? ''));
if ($uuid === '') {
    Router::redirect('login');
}

if (!can('users.view') && !can('users.self_update') && !can('users.update')) {
    Router::redirect('error/forbidden');
}

Router::redirect(lurl("admin/users/edit/{$uuid}"));
