46 lines
1.2 KiB
PHP
46 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App;
|
|
|
|
enum WorkspaceType: string
|
|
{
|
|
case Personal = 'personal';
|
|
case Family = 'family';
|
|
case Organization = 'organization';
|
|
|
|
/**
|
|
* Get the human-friendly label for the workspace type.
|
|
*/
|
|
public function label(): string
|
|
{
|
|
return match ($this) {
|
|
self::Personal => 'Personal',
|
|
self::Family => 'Family',
|
|
self::Organization => 'Organization',
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Get the visibility a new top-level folder receives by default in this
|
|
* kind of workspace. Personal workspaces are single-user, so their folders
|
|
* start private; family and organization folders are shared with every
|
|
* member until an admin narrows them.
|
|
*/
|
|
public function defaultFolderVisibility(): FolderVisibility
|
|
{
|
|
return match ($this) {
|
|
self::Personal => FolderVisibility::Private,
|
|
self::Family, self::Organization => FolderVisibility::Workspace,
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Determine whether folders in this workspace are shared with members by
|
|
* default.
|
|
*/
|
|
public function sharesByDefault(): bool
|
|
{
|
|
return $this !== self::Personal;
|
|
}
|
|
}
|