Assign the existing site to one landlord so stommer.info can run tenancy.
Seebad 0.3 stays in this release. With a single landlord every host still reaches the default website. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
d9e52c4789
commit
8ebc1a3878
93 files changed
+2506
-112
No files matched your search
@@ -2,20 +2,26 @@
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use App\Enums\Permission;
|
||||
use App\Models\User;
|
||||
|
||||
/**
|
||||
* Only administrators manage accounts; nobody can delete their own account.
|
||||
* Only administrators of the current landlord manage accounts. A shared account is detached, not deleted,
|
||||
* and nobody can delete their own account.
|
||||
*/
|
||||
class UserPolicy extends RolePolicy
|
||||
{
|
||||
protected function roles(): array
|
||||
protected function permission(): Permission
|
||||
{
|
||||
return [];
|
||||
return Permission::Users;
|
||||
}
|
||||
|
||||
public function delete(User $user, ?User $model = null): bool
|
||||
{
|
||||
return $this->allows($user) && ! $user->is($model);
|
||||
if (! $this->allows($user) || $user->is($model)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $model === null || $model->tenants()->count() < 2;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user