feat: default Presentation

fixed some formatting with cs-fixer
pull/207/head
Specht, David 2022-05-24 23:58:07 +02:00
parent 7f2372d207
commit e0bc1a2332
5 changed files with 23 additions and 43 deletions

View File

@ -8,12 +8,10 @@ use OCP\AppFramework\Utility\ITimeFactory;
use OCP\Files\IRootFolder;
use OCP\Files\File;
use OCP\Files\Folder;
use OCP\Files\Storage\IStorage;
use OCP\IURLGenerator;
use OCP\Security\ISecureRandom;
class Presentation
{
class Presentation {
private $url;
private $userId;
@ -53,8 +51,7 @@ class Presentation
$this->urlGenerator = $urlGenerator;
}
public function generateUrl()
{
public function generateUrl() {
$direct = new Direct();
$direct->setUserId($this->userId);
$direct->setFileId($this->file->getId());
@ -70,18 +67,15 @@ class Presentation
return $url;
}
public function getUrl(): string
{
public function getUrl(): string {
return $this->url;
}
public function getFilename(): string
{
public function getFilename(): string {
return $this->file->getName();
}
public function isValid(): bool
{
public function isValid(): bool {
return !empty($this->file->getContent());
}
}

View File

@ -22,8 +22,7 @@ use OCP\IURLGenerator;
use OCP\IUserSession;
use OCP\Security\ISecureRandom;
class JoinController extends Controller
{
class JoinController extends Controller {
/** @var string */
protected $token;
@ -88,14 +87,12 @@ class JoinController extends Controller
$this->timeFactory = $timeFactory;
}
public function setToken(string $token): void
{
public function setToken(string $token): void {
$this->token = $token;
$this->room = null;
}
public function isValidToken(): bool
{
public function isValidToken(): bool {
$room = $this->getRoom();
return $room !== null;
@ -108,8 +105,7 @@ class JoinController extends Controller
*
* @return RedirectResponse|TemplateResponse
*/
public function index($displayname, $u = '', $filename = '', $password = '')
{
public function index($displayname, $u = '', $filename = '', $password = '') {
$room = $this->getRoom();
if ($room === null) {
@ -176,8 +172,7 @@ class JoinController extends Controller
], 'guest');
}
private function getRoom(): ?Room
{
private function getRoom(): ?Room {
if ($this->room === null) {
$this->room = $this->service->findByUid($this->token);
}
@ -185,8 +180,7 @@ class JoinController extends Controller
return $this->room;
}
private function getLoginUrl(): string
{
private function getLoginUrl(): string {
return $this->urlGenerator->linkToRoute('core.login.showLoginForm', [
'redirect_url' => $this->urlGenerator->linkToRoute(
'bbb.join.index',
@ -195,8 +189,7 @@ class JoinController extends Controller
]);
}
private function markAsRunning(Room $room)
{
private function markAsRunning(Room $room) {
if (!$room->running) {
$this->service->updateRunning($room->getId(), true);
}

View File

@ -13,8 +13,8 @@ use OCP\IGroupManager;
use OCP\IRequest;
use OCP\IUserManager;
class RoomController extends Controller
{
class RoomController extends Controller {
use Errors;
/** @var RoomService */
private $service;
@ -33,8 +33,6 @@ class RoomController extends Controller
/** @var string */
private $userId;
use Errors;
public function __construct(
$appName,
IRequest $request,
@ -57,8 +55,7 @@ class RoomController extends Controller
/**
* @NoAdminRequired
*/
public function index(): DataResponse
{
public function index(): DataResponse {
$user = $this->userManager->get($this->userId);
$groupIds = $this->groupManager->getUserGroupIds($user);
$circleIds = $this->circleHelper->getCircleIds($this->userId);
@ -166,8 +163,7 @@ class RoomController extends Controller
/**
* @NoAdminRequired
*/
public function destroy(int $id): DataResponse
{
public function destroy(int $id): DataResponse {
$room = $this->service->find($id);
if (!$this->permission->isAdmin($room, $this->userId)) {

View File

@ -34,18 +34,14 @@ use OCP\Migration\SimpleMigrationStep;
/**
* Auto-generated migration step: Please modify to your needs!
*/
class Version000000Date20220413130357 extends SimpleMigrationStep
{
class Version000000Date20220413130357 extends SimpleMigrationStep {
/**
* @param IOutput $output
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
* @param array $options
* @return null|ISchemaWrapper
*/
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper
{
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
$schema = $schemaClosure();
if ($schema->hasTable('bbb_rooms')) {

View File

@ -16,7 +16,6 @@ use OCP\IConfig;
use OCP\Security\ISecureRandom;
class RoomService {
/** @var RoomMapper */
private $mapper;
@ -33,7 +32,8 @@ class RoomService {
RoomMapper $mapper,
IConfig $config,
IEventDispatcher $eventDispatcher,
ISecureRandom $random) {
ISecureRandom $random
) {
$this->mapper = $mapper;
$this->config = $config;
$this->eventDispatcher = $eventDispatcher;
@ -137,7 +137,8 @@ class RoomService {
bool $cleanLayout,
bool $joinMuted,
string $presentationUserId,
string $presentationPath) {
string $presentationPath
) {
try {
$room = $this->mapper->find($id);