diff --git a/doc/webroot-db.uml.uxf b/doc/webroot-db.uml.uxf
new file mode 100644
index 0000000..c4f0ab6
--- /dev/null
+++ b/doc/webroot-db.uml.uxf
@@ -0,0 +1,123 @@
+
+
+ 10
+
+ UMLClass
+
+ 20
+ 20
+ 410
+ 130
+
+ _object: WebrootFile_
+--
+id: Integer
+url: string
+abspath: string
+is_dir: boolean
+owner: WebrootUser
+permissions: Collection(WebrootFilePermission)
+
+
+
+
+
+
+ UMLClass
+
+ 600
+ 10
+ 230
+ 100
+
+ _object: WebrootUser_
+--
+id: Integer
+username: string[255]
+email: string[255]
+roles: string (json-list)
+password: string
+
+
+
+
+ UMLClass
+
+ 620
+ 120
+ 280
+ 80
+
+ _object: WebrootFilePermission_
+--
+id: Integer
+role: WebrootRole
+webrootFile: WebrootFile
+is_readable: boolean
+is_writeable: boolean
+is_dir: boolean
+
+
+
+
+ UMLClass
+
+ 100
+ 200
+ 210
+ 80
+
+ _object: WebrootRole_
+--
+id: Integer
+role: string[255]
+name: string[255]
+description: string
+
+
+
+
+ Relation
+
+ 420
+ 10
+ 200
+ 110
+
+ lt=<<<<-
+ 10.0;90.0;180.0;10.0
+
+
+ Relation
+
+ 420
+ 110
+ 220
+ 40
+
+ lt=<<<<-
+ 10.0;10.0;200.0;20.0
+
+
+ Relation
+
+ 300
+ 150
+ 340
+ 80
+
+ lt=<<<<-
+ 320.0;10.0;10.0;60.0
+
+
+ Relation
+
+ 410
+ 20
+ 230
+ 180
+
+ lt=<<<<-
+ 210.0;160.0;10.0;10.0
+
+
diff --git a/migrations/Version20241126013626.php b/migrations/Version20241126013626.php
new file mode 100644
index 0000000..c373fdc
--- /dev/null
+++ b/migrations/Version20241126013626.php
@@ -0,0 +1,84 @@
+addSql('CREATE TABLE mydevel_webroot_file (
+ id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
+ owner_id INTEGER NOT NULL,
+ url CLOB NOT NULL,
+ abspath CLOB NOT NULL,
+ CONSTRAINT FK_A7B135127E3C61F9 FOREIGN KEY (owner_id) REFERENCES mydevel_webroot_user (id) NOT DEFERRABLE INITIALLY IMMEDIATE
+ )');
+ $this->addSql('CREATE UNIQUE INDEX UNIQ_A7B135127E3C61F9 ON mydevel_webroot_file (owner_id)');
+ $this->addSql('CREATE TABLE mydevel_webroot_file_permission (
+ id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
+ role_id INTEGER NOT NULL,
+ webroot_file_id INTEGER NOT NULL,
+ is_readable BOOLEAN DEFAULT 1 NOT NULL,
+ is_writeable BOOLEAN DEFAULT 0 NOT NULL,
+ is_deleteable BOOLEAN DEFAULT 0 NOT NULL,
+ CONSTRAINT FK_4D56CEFD60322AC FOREIGN KEY (role_id) REFERENCES mydevel_webroot_role (id) NOT DEFERRABLE INITIALLY IMMEDIATE,
+ CONSTRAINT FK_4D56CEF2800AFC9 FOREIGN KEY (webroot_file_id) REFERENCES mydevel_webroot_file (id) NOT DEFERRABLE INITIALLY IMMEDIATE
+ )');
+ $this->addSql('CREATE UNIQUE INDEX UNIQ_4D56CEFD60322AC ON mydevel_webroot_file_permission (role_id)');
+ $this->addSql('CREATE INDEX IDX_4D56CEF2800AFC9 ON mydevel_webroot_file_permission (webroot_file_id)');
+ $this->addSql('CREATE TABLE mydevel_webroot_role (
+ id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
+ role VARCHAR(255) NOT NULL,
+ name VARCHAR(255) NOT NULL,
+ description VARCHAR(1023) DEFAULT NULL
+ )');
+ $this->addSql('CREATE TABLE mydevel_webroot_user (
+ id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
+ username VARCHAR(180) NOT NULL,
+ roles CLOB NOT NULL --(DC2Type:json)
+ ,
+ password VARCHAR(255) NOT NULL,
+ email VARCHAR(255) NOT NULL
+ )');
+ $this->addSql('CREATE UNIQUE INDEX UNIQ_A6BDD54BE7927C74 ON mydevel_webroot_user (email)');
+ $this->addSql('CREATE UNIQUE INDEX UNIQ_IDENTIFIER_USERNAME ON mydevel_webroot_user (username)');
+ $this->addSql('CREATE TABLE messenger_messages (
+ id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
+ body CLOB NOT NULL,
+ headers CLOB NOT NULL,
+ queue_name VARCHAR(190) NOT NULL,
+ created_at DATETIME NOT NULL --(DC2Type:datetime_immutable)
+ ,
+ available_at DATETIME NOT NULL --(DC2Type:datetime_immutable)
+ ,
+ delivered_at DATETIME DEFAULT NULL --(DC2Type:datetime_immutable)
+ )');
+ $this->addSql('CREATE INDEX IDX_75EA56E0FB7336F0 ON messenger_messages (queue_name)');
+ $this->addSql('CREATE INDEX IDX_75EA56E0E3BD61CE ON messenger_messages (available_at)');
+ $this->addSql('CREATE INDEX IDX_75EA56E016BA31DB ON messenger_messages (delivered_at)');
+ }
+
+ public function down(Schema $schema): void
+ {
+ // this down() migration is auto-generated, please modify it to your needs
+ $this->addSql('DROP TABLE mydevel_webroot_file');
+ $this->addSql('DROP TABLE mydevel_webroot_file_permission');
+ $this->addSql('DROP TABLE mydevel_webroot_role');
+ $this->addSql('DROP TABLE mydevel_webroot_user');
+ $this->addSql('DROP TABLE messenger_messages');
+ }
+}
diff --git a/src/Entity/WebrootFile.php b/src/Entity/WebrootFile.php
index 7932bf0..646730b 100644
--- a/src/Entity/WebrootFile.php
+++ b/src/Entity/WebrootFile.php
@@ -7,7 +7,8 @@ use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
-#[ORM\Entity(repositoryClass: WebrootFileRepository::class)]
+#[ORM\Entity(repositoryClass: WebrootFileRepository::class,)]
+#[ORM\Table(name:'mydevel_webroot_file')]
class WebrootFile
{
#[ORM\Id]
@@ -15,21 +16,23 @@ class WebrootFile
#[ORM\Column]
private ?int $id = null;
- #[ORM\Column(length: 65535)]
+ #[ORM\Column(length: 65535,nullable:false)]
private ?string $url = null;
- #[ORM\Column(length: 65535)]
+ #[ORM\Column(length: 65535,nullable:false)]
private ?string $abspath = null;
- #[ORM\Column]
- private ?bool $is_dir = null;
/**
* @var Collection
*/
- #[ORM\OneToMany(targetEntity: WebrootPermission::class, mappedBy: 'webrootFile', orphanRemoval: true)]
+ #[ORM\OneToMany(targetEntity: WebrootFilePermission::class, mappedBy: 'webrootFile', orphanRemoval: true)]
private Collection $permissions;
+ #[ORM\OneToOne(cascade: ['persist', 'remove'])]
+ #[ORM\JoinColumn(nullable: false)]
+ private ?WebrootUser $owner = null;
+
public function __construct()
{
$this->permissions = new ArrayCollection();
@@ -64,18 +67,6 @@ class WebrootFile
return $this;
}
- public function isDir(): ?bool
- {
- return $this->is_dir;
- }
-
- public function setDir(bool $is_dir): static
- {
- $this->is_dir = $is_dir;
-
- return $this;
- }
-
/**
* @return Collection
*/
@@ -94,7 +85,7 @@ class WebrootFile
return $this;
}
- public function removePermission(WebrootPermission $permission): static
+ public function removePermission(WebrootFilePermission $permission): static
{
if ($this->permissions->removeElement($permission)) {
// set the owning side to null (unless already changed)
@@ -105,4 +96,16 @@ class WebrootFile
return $this;
}
+
+ public function getOwner(): ?WebrootUser
+ {
+ return $this->owner;
+ }
+
+ public function setOwner(WebrootUser $owner): static
+ {
+ $this->owner = $owner;
+
+ return $this;
+ }
}
diff --git a/src/Entity/WebrootPermission.php b/src/Entity/WebrootFilePermission.php
similarity index 85%
rename from src/Entity/WebrootPermission.php
rename to src/Entity/WebrootFilePermission.php
index e9b1a13..49b6e69 100644
--- a/src/Entity/WebrootPermission.php
+++ b/src/Entity/WebrootFilePermission.php
@@ -6,7 +6,8 @@ use App\Repository\WebrootPermissionRepository;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: WebrootPermissionRepository::class)]
-class WebrootPermission
+#[ORM\Table(name:'mydevel_webroot_file_permission')]
+class WebrootFilePermission
{
#[ORM\Id]
#[ORM\GeneratedValue]
@@ -17,18 +18,15 @@ class WebrootPermission
#[ORM\JoinColumn(nullable: false)]
private ?WebrootRole $role = null;
- #[ORM\Column]
+ #[ORM\Column(options:["default"=>true])]
private ?bool $is_readable = null;
- #[ORM\Column]
+ #[ORM\Column(options:["default"=>false])]
private ?bool $is_writeable = null;
- #[ORM\Column]
+ #[ORM\Column(options:["default"=>false])]
private ?bool $is_deleteable = null;
- #[ORM\Column]
- private ?bool $is_dir = null;
-
#[ORM\ManyToOne(inversedBy: 'permissions')]
#[ORM\JoinColumn(nullable: false)]
private ?WebrootFile $webrootFile = null;
@@ -85,19 +83,7 @@ class WebrootPermission
return $this;
}
-
- public function isDir(): ?bool
- {
- return $this->is_dir;
- }
-
- public function setDir(bool $is_dir): static
- {
- $this->is_dir = $is_dir;
-
- return $this;
- }
-
+
public function getWebrootFile(): ?WebrootFile
{
return $this->webrootFile;
diff --git a/src/Entity/WebrootRole.php b/src/Entity/WebrootRole.php
index 13e6c21..5b03f36 100644
--- a/src/Entity/WebrootRole.php
+++ b/src/Entity/WebrootRole.php
@@ -6,6 +6,7 @@ use App\Repository\WebrootRoleRepository;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: WebrootRoleRepository::class)]
+#[ORM\Table(name:'mydevel_webroot_role')]
class WebrootRole
{
#[ORM\Id]
diff --git a/src/Entity/WebrootUser.php b/src/Entity/WebrootUser.php
index 58a177b..3ea2747 100644
--- a/src/Entity/WebrootUser.php
+++ b/src/Entity/WebrootUser.php
@@ -9,6 +9,7 @@ use Symfony\Component\Security\Core\User\UserInterface;
#[ORM\Entity(repositoryClass: WebrootUserRepository::class)]
#[ORM\UniqueConstraint(name: 'UNIQ_IDENTIFIER_USERNAME', fields: ['username'])]
+#[ORM\Table(name:'mydevel_webroot_user')]
class WebrootUser implements UserInterface, PasswordAuthenticatedUserInterface
{
#[ORM\Id]
@@ -31,6 +32,9 @@ class WebrootUser implements UserInterface, PasswordAuthenticatedUserInterface
#[ORM\Column]
private ?string $password = null;
+ #[ORM\Column(length: 255, unique:true)]
+ private ?string $email = null;
+
public function getId(): ?int
{
return $this->id;
@@ -105,4 +109,16 @@ class WebrootUser implements UserInterface, PasswordAuthenticatedUserInterface
// If you store any temporary, sensitive data on the user, clear it here
// $this->plainPassword = null;
}
+
+ public function getEmail(): ?string
+ {
+ return $this->email;
+ }
+
+ public function setEmail(string $email): static
+ {
+ $this->email = $email;
+
+ return $this;
+ }
}
diff --git a/src/Repository/WebrootPermissionRepository.php b/src/Repository/WebrootFilePermissionRepository.php
similarity index 89%
rename from src/Repository/WebrootPermissionRepository.php
rename to src/Repository/WebrootFilePermissionRepository.php
index f3ff99b..752fe98 100644
--- a/src/Repository/WebrootPermissionRepository.php
+++ b/src/Repository/WebrootFilePermissionRepository.php
@@ -9,11 +9,11 @@ use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository
*/
-class WebrootPermissionRepository extends ServiceEntityRepository
+class WebrootFilePermissionRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
- parent::__construct($registry, WebrootPermission::class);
+ parent::__construct($registry, WebrootFilePermission::class);
}
// /**