Loading config/module.config.php +4 −0 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ use Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain; use Doctrine\ORM\Mapping\Driver\XmlDriver; use UnicaenUtilisateur\ORM\Event\Listeners\HistoriqueListener; use UnicaenUtilisateur\ORM\Event\Listeners\HistoriqueListenerFactory; use UnicaenUtilisateur\View\Helper\RoleViewHelper; use UnicaenUtilisateur\View\Helper\UserConnection; use UnicaenUtilisateur\View\Helper\UserConnectionFactory; use UnicaenUtilisateur\View\Helper\UserCurrent; Loading Loading @@ -78,6 +79,9 @@ return [ ], 'view_helpers' => [ 'invokables' => [ 'role' => RoleViewHelper::class, ], 'aliases' => [ 'userCurrent' => UserCurrent::class, 'userStatus' => UserStatus::class, Loading data/sql/schema_oracle.sql +1 −0 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ CREATE TABLE UNICAEN_UTILISATEUR_ROLE ( ID NUMBER(*, 0) NOT NULL, ROLE_ID VARCHAR2(64) NOT NULL, LIBELLE VARCHAR2(255) NOT NULL, DESCRIPTION CLOB NOT NULL, IS_DEFAULT NUMBER(1) DEFAULT 0 NOT NULL, IS_AUTO NUMBER(1) DEFAULT 0 NOT NULL, PARENT_ID NUMBER(*, 0), Loading data/sql/schema_postgresql.sql +1 −0 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ CREATE TABLE UNICAEN_UTILISATEUR_ROLE ( ID SERIAL PRIMARY KEY, ROLE_ID VARCHAR(64) NOT NULL, LIBELLE VARCHAR(255) NOT NULL, DESCRIPTION TEXT NOT NULL, IS_DEFAULT BOOLEAN DEFAULT false NOT NULL, IS_AUTO BOOLEAN DEFAULT false NOT NULL, PARENT_ID INTEGER, Loading readme.md +8 −0 Original line number Diff line number Diff line Loading @@ -2,6 +2,14 @@ Module Unicaen Utilisateur ======================= ------------------------ Changelogs ========== **5.0.7** * Ajout du champs description pour les rôles * Ajout d'un view helper pour l'affichage des rôles ```echo $this->role($role)``` * Début de nettoyage des classes vers la syntaxe PHP8 Description ======================= Loading src/UnicaenUtilisateur/Entity/Db/AbstractRole.php +55 −228 Original line number Diff line number Diff line Loading @@ -8,325 +8,152 @@ use UnicaenPrivilege\Entity\Db\PrivilegeInterface; abstract class AbstractRole implements RoleInterface { /** * @var int */ protected $id; /** * @var string */ protected $roleId; /** * @var string */ protected $libelle; /** * @var boolean */ protected $default = false; /** * @var boolean */ protected $auto = false; /** * @var RoleInterface */ protected $parent; /** * @var string */ protected $ldapFilter; /** * @var boolean */ protected $accessibleExterieur = true; /** * @var ArrayCollection */ protected $users; /** * @var ArrayCollection */ protected $privileges; /** * AbstractRole constructor. */ protected ?int $id = null; protected ?string $roleId = null; protected ?string $libelle = null; protected ?string $description = null; protected bool $default = false; protected bool $auto = false; protected ?RoleInterface $parent = null; protected ?string $ldapFilter = null; protected bool $accessibleExterieur = true; protected Collection $users; protected Collection $privileges; public function __construct() { $this->users = new ArrayCollection(); $this->privileges = new ArrayCollection(); } /** * @return string */ public function __toString() { return $this->getLibelle(); } /** * Get id. * * @return int|null */ public function getId() : ?int { return $this->id; } /** * Set id. * * @param int $id * @return RoleInterface */ public function setId($id) public function setId(?int $id) : void { $this->id = (int)$id; return $this; } /** * Get roleId. * * @return string */ public function getRoleId() public function getRoleId() : ?string { return $this->roleId; } /** * Set roleId. * * @param string $roleId * @return RoleInterface */ public function setRoleId($roleId) public function setRoleId(?string $roleId) : void { $this->roleId = (string)$roleId; return $this; } /** * Get libelle. * * @return string */ public function getLibelle() public function getLibelle() : ?string { return $this->libelle; } /** * Set libelle. * * @param string|null $libelle * @return RoleInterface */ public function setLibelle($libelle) public function setLibelle(?string $libelle) : void { $this->libelle = $libelle; return $this; } /** * Is this role the default one ? * * @return boolean */ public function isDefault() public function getDescription(): ?string { return $this->description; } public function setDescription(?string $description): void { $this->description = $description; } public function isDefault() : bool { return $this->default; } /** * Set this role as the default one. * * @param boolean $default * @return RoleInterface */ public function setDefault($default) public function setDefault(bool $default) : void { $this->default = (boolean) $default; return $this; } /** * Is auto ? * * @return boolean */ public function isAuto() public function isAuto() : bool { return $this->auto; } /** * Set auto. * * @param boolean $auto * @return RoleInterface */ public function setAuto($auto) public function setAuto(bool $auto) : void { $this->auto = $auto; return $this; } /** * Is accessible from the outside ? * * @return boolean */ public function isAccessibleExterieur() public function isAccessibleExterieur() : bool { return $this->accessibleExterieur; } /** * Set accessible from the outside. * * @param boolean $accessibleExterieur * @return RoleInterface */ public function setAccessibleExterieur($accessibleExterieur) public function setAccessibleExterieur(bool $accessibleExterieur) : void { $this->accessibleExterieur = $accessibleExterieur; return $this; } /** * Get the parent role * * @return RoleInterface */ public function getParent() public function getParent() : ?RoleInterface { return $this->parent; } /** * Set the parent role. * * @param RoleInterface|null $parent * @return RoleInterface */ public function setParent(?RoleInterface $parent = null) public function setParent(?RoleInterface $parent = null) : void { $this->parent = $parent; return $this; } /** * Get ldapFilter. * * @return string */ public function getLdapFilter() public function getLdapFilter() : ?string { return $this->ldapFilter; } /** * Set ldapFilter. * * @param string $ldapFilter * @return RoleInterface */ public function setLdapFilter($ldapFilter) public function setLdapFilter(?string $ldapFilter) : void { $this->ldapFilter = $ldapFilter; return $this; } /** * Get users. * * @return Collection */ public function getUsers() public function getUsers() : Collection { return $this->users; } /** * Add user. * * @param UserInterface $user * @return RoleInterface */ public function addUser(UserInterface $user) public function addUser(UserInterface $user) : void { $this->users->add($user); return $this; } /** * Remove user. * * @param UserInterface $user * @return RoleInterface */ public function removeUser(UserInterface $user) public function removeUser(UserInterface $user) : void { $this->users->removeElement($user); return $this; } /** * Get privileges. * * @return Collection */ public function getPrivileges() public function getPrivileges() : Collection { return $this->privileges; } /** * Add privilege. * * @param PrivilegeInterface $privilege * @return RoleInterface */ public function addPrivilege(PrivilegeInterface $privilege) public function addPrivilege(PrivilegeInterface $privilege) : void { $this->privileges->add($privilege); return $this; } /** * Remove privilege. * * @param PrivilegeInterface $privilege * @return RoleInterface */ public function removePrivilege(PrivilegeInterface $privilege) public function removePrivilege(PrivilegeInterface $privilege) : void { $this->privileges->removeElement($privilege); } /** Fonctions magiques ********************************************************************************************/ return $this; public function __toString() : string { return $this->getLibelle(); } } No newline at end of file Loading
config/module.config.php +4 −0 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ use Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain; use Doctrine\ORM\Mapping\Driver\XmlDriver; use UnicaenUtilisateur\ORM\Event\Listeners\HistoriqueListener; use UnicaenUtilisateur\ORM\Event\Listeners\HistoriqueListenerFactory; use UnicaenUtilisateur\View\Helper\RoleViewHelper; use UnicaenUtilisateur\View\Helper\UserConnection; use UnicaenUtilisateur\View\Helper\UserConnectionFactory; use UnicaenUtilisateur\View\Helper\UserCurrent; Loading Loading @@ -78,6 +79,9 @@ return [ ], 'view_helpers' => [ 'invokables' => [ 'role' => RoleViewHelper::class, ], 'aliases' => [ 'userCurrent' => UserCurrent::class, 'userStatus' => UserStatus::class, Loading
data/sql/schema_oracle.sql +1 −0 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ CREATE TABLE UNICAEN_UTILISATEUR_ROLE ( ID NUMBER(*, 0) NOT NULL, ROLE_ID VARCHAR2(64) NOT NULL, LIBELLE VARCHAR2(255) NOT NULL, DESCRIPTION CLOB NOT NULL, IS_DEFAULT NUMBER(1) DEFAULT 0 NOT NULL, IS_AUTO NUMBER(1) DEFAULT 0 NOT NULL, PARENT_ID NUMBER(*, 0), Loading
data/sql/schema_postgresql.sql +1 −0 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ CREATE TABLE UNICAEN_UTILISATEUR_ROLE ( ID SERIAL PRIMARY KEY, ROLE_ID VARCHAR(64) NOT NULL, LIBELLE VARCHAR(255) NOT NULL, DESCRIPTION TEXT NOT NULL, IS_DEFAULT BOOLEAN DEFAULT false NOT NULL, IS_AUTO BOOLEAN DEFAULT false NOT NULL, PARENT_ID INTEGER, Loading
readme.md +8 −0 Original line number Diff line number Diff line Loading @@ -2,6 +2,14 @@ Module Unicaen Utilisateur ======================= ------------------------ Changelogs ========== **5.0.7** * Ajout du champs description pour les rôles * Ajout d'un view helper pour l'affichage des rôles ```echo $this->role($role)``` * Début de nettoyage des classes vers la syntaxe PHP8 Description ======================= Loading
src/UnicaenUtilisateur/Entity/Db/AbstractRole.php +55 −228 Original line number Diff line number Diff line Loading @@ -8,325 +8,152 @@ use UnicaenPrivilege\Entity\Db\PrivilegeInterface; abstract class AbstractRole implements RoleInterface { /** * @var int */ protected $id; /** * @var string */ protected $roleId; /** * @var string */ protected $libelle; /** * @var boolean */ protected $default = false; /** * @var boolean */ protected $auto = false; /** * @var RoleInterface */ protected $parent; /** * @var string */ protected $ldapFilter; /** * @var boolean */ protected $accessibleExterieur = true; /** * @var ArrayCollection */ protected $users; /** * @var ArrayCollection */ protected $privileges; /** * AbstractRole constructor. */ protected ?int $id = null; protected ?string $roleId = null; protected ?string $libelle = null; protected ?string $description = null; protected bool $default = false; protected bool $auto = false; protected ?RoleInterface $parent = null; protected ?string $ldapFilter = null; protected bool $accessibleExterieur = true; protected Collection $users; protected Collection $privileges; public function __construct() { $this->users = new ArrayCollection(); $this->privileges = new ArrayCollection(); } /** * @return string */ public function __toString() { return $this->getLibelle(); } /** * Get id. * * @return int|null */ public function getId() : ?int { return $this->id; } /** * Set id. * * @param int $id * @return RoleInterface */ public function setId($id) public function setId(?int $id) : void { $this->id = (int)$id; return $this; } /** * Get roleId. * * @return string */ public function getRoleId() public function getRoleId() : ?string { return $this->roleId; } /** * Set roleId. * * @param string $roleId * @return RoleInterface */ public function setRoleId($roleId) public function setRoleId(?string $roleId) : void { $this->roleId = (string)$roleId; return $this; } /** * Get libelle. * * @return string */ public function getLibelle() public function getLibelle() : ?string { return $this->libelle; } /** * Set libelle. * * @param string|null $libelle * @return RoleInterface */ public function setLibelle($libelle) public function setLibelle(?string $libelle) : void { $this->libelle = $libelle; return $this; } /** * Is this role the default one ? * * @return boolean */ public function isDefault() public function getDescription(): ?string { return $this->description; } public function setDescription(?string $description): void { $this->description = $description; } public function isDefault() : bool { return $this->default; } /** * Set this role as the default one. * * @param boolean $default * @return RoleInterface */ public function setDefault($default) public function setDefault(bool $default) : void { $this->default = (boolean) $default; return $this; } /** * Is auto ? * * @return boolean */ public function isAuto() public function isAuto() : bool { return $this->auto; } /** * Set auto. * * @param boolean $auto * @return RoleInterface */ public function setAuto($auto) public function setAuto(bool $auto) : void { $this->auto = $auto; return $this; } /** * Is accessible from the outside ? * * @return boolean */ public function isAccessibleExterieur() public function isAccessibleExterieur() : bool { return $this->accessibleExterieur; } /** * Set accessible from the outside. * * @param boolean $accessibleExterieur * @return RoleInterface */ public function setAccessibleExterieur($accessibleExterieur) public function setAccessibleExterieur(bool $accessibleExterieur) : void { $this->accessibleExterieur = $accessibleExterieur; return $this; } /** * Get the parent role * * @return RoleInterface */ public function getParent() public function getParent() : ?RoleInterface { return $this->parent; } /** * Set the parent role. * * @param RoleInterface|null $parent * @return RoleInterface */ public function setParent(?RoleInterface $parent = null) public function setParent(?RoleInterface $parent = null) : void { $this->parent = $parent; return $this; } /** * Get ldapFilter. * * @return string */ public function getLdapFilter() public function getLdapFilter() : ?string { return $this->ldapFilter; } /** * Set ldapFilter. * * @param string $ldapFilter * @return RoleInterface */ public function setLdapFilter($ldapFilter) public function setLdapFilter(?string $ldapFilter) : void { $this->ldapFilter = $ldapFilter; return $this; } /** * Get users. * * @return Collection */ public function getUsers() public function getUsers() : Collection { return $this->users; } /** * Add user. * * @param UserInterface $user * @return RoleInterface */ public function addUser(UserInterface $user) public function addUser(UserInterface $user) : void { $this->users->add($user); return $this; } /** * Remove user. * * @param UserInterface $user * @return RoleInterface */ public function removeUser(UserInterface $user) public function removeUser(UserInterface $user) : void { $this->users->removeElement($user); return $this; } /** * Get privileges. * * @return Collection */ public function getPrivileges() public function getPrivileges() : Collection { return $this->privileges; } /** * Add privilege. * * @param PrivilegeInterface $privilege * @return RoleInterface */ public function addPrivilege(PrivilegeInterface $privilege) public function addPrivilege(PrivilegeInterface $privilege) : void { $this->privileges->add($privilege); return $this; } /** * Remove privilege. * * @param PrivilegeInterface $privilege * @return RoleInterface */ public function removePrivilege(PrivilegeInterface $privilege) public function removePrivilege(PrivilegeInterface $privilege) : void { $this->privileges->removeElement($privilege); } /** Fonctions magiques ********************************************************************************************/ return $this; public function __toString() : string { return $this->getLibelle(); } } No newline at end of file