permissions
This commit is contained in:
@@ -2,13 +2,18 @@
|
||||
|
||||
namespace Lucent\Account;
|
||||
|
||||
use Lucent\Channel\ChannelService;
|
||||
use Lucent\Primitive\Collection;
|
||||
use Lucent\Schema\SchemaService;
|
||||
|
||||
readonly class AccountService
|
||||
{
|
||||
|
||||
public function __construct(
|
||||
private UserRepo $userRepo,
|
||||
private AuthService $authService,
|
||||
private ChannelService $channelService,
|
||||
private SchemaService $schemaService,
|
||||
private UserRepo $userRepo,
|
||||
)
|
||||
{
|
||||
|
||||
@@ -37,5 +42,20 @@ readonly class AccountService
|
||||
return $this->all()->map(fn($user) => $user->safe());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string>
|
||||
*/
|
||||
public function currentReadableSchemas(): array
|
||||
{
|
||||
$roles = $this->authService->currentUserRoles();
|
||||
return $this->channelService->schemasReadableByRoles($roles);
|
||||
}
|
||||
|
||||
public function currentWritableSchemas(): array
|
||||
{
|
||||
$roles = $this->authService->currentUserRoles();
|
||||
return $this->channelService->schemasWritableByRoles($roles);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user