@@ -0,0 +1,45 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user