26 lines
414 B
PHP
26 lines
414 B
PHP
|
<?php
|
||
|
|
||
|
declare(strict_types=1);
|
||
|
|
||
|
namespace OCA\Radio\Service;
|
||
|
|
||
|
use OCP\IUser;
|
||
|
use OCP\IUserSession;
|
||
|
|
||
|
class UserService
|
||
|
{
|
||
|
public function __construct(
|
||
|
private readonly IUserSession $userSession
|
||
|
) {}
|
||
|
|
||
|
public function getUserUID(): string {
|
||
|
$user = $this->getUser();
|
||
|
|
||
|
return $user instanceof IUser ? $user->getUID() : '';
|
||
|
}
|
||
|
|
||
|
public function getUser(): ?IUser {
|
||
|
return $this->userSession->getUser();
|
||
|
}
|
||
|
}
|