From fe55d55d26af387b0439a685e9218035b4b32eb7 Mon Sep 17 00:00:00 2001 From: Bertrand Gauthier <bertrand.gauthier@unicaen.fr> Date: Wed, 2 Oct 2013 11:27:45 +0000 Subject: [PATCH] =?UTF-8?q?SUppression=20champ=20'name'=20dans=20la=20tabl?= =?UTF-8?q?e=20des=20r=C3=B4les=20(user=5Frole).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data/schema.sql | 8 ++++-- src/UnicaenAuth/Entity/Db/Role.php | 29 -------------------- tests/UnicaenAuthTest/Entity/Db/RoleTest.php | 6 ---- 3 files changed, 5 insertions(+), 38 deletions(-) diff --git a/data/schema.sql b/data/schema.sql index db3fa75..3cabd51 100644 --- a/data/schema.sql +++ b/data/schema.sql @@ -12,7 +12,6 @@ CREATE TABLE user ( CREATE TABLE IF NOT EXISTS `user_role` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `role_id` VARCHAR(64) NOT NULL, - `name` VARCHAR(255) NOT NULL, `is_default` TINYINT(1) NOT NULL DEFAULT 0, `parent_id` INT(11) NULL DEFAULT NULL, PRIMARY KEY (`id`), @@ -31,5 +30,8 @@ CREATE TABLE IF NOT EXISTS `user_role_linker` ( CONSTRAINT `fk_user_id` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE CASCADE ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8 COLLATE = utf8_unicode_ci; -INSERT INTO user_role (role_id, description, is_default) -VALUES ('guest', 'Invité', 1); +INSERT INTO `user_role` (`id`, `role_id`, `is_default`, `parent_id`) VALUES +(1, 'Standard', 1, NULL), +(2, 'Gestionnaire', 0, 1), +(3, 'Super-gestionnaire', 0, 2), +(4, 'Administrateur de l''application', 0, 3); diff --git a/src/UnicaenAuth/Entity/Db/Role.php b/src/UnicaenAuth/Entity/Db/Role.php index 3ec1ec1..4918ca6 100644 --- a/src/UnicaenAuth/Entity/Db/Role.php +++ b/src/UnicaenAuth/Entity/Db/Role.php @@ -33,12 +33,6 @@ class Role implements HierarchicalRoleInterface */ protected $roleId; - /** - * @var string - * @ORM\Column(type="string", length=255, nullable=true) - */ - protected $name; - /** * @var boolean * @ORM\Column(name="is_default", type="boolean", nullable=false) @@ -97,29 +91,6 @@ class Role implements HierarchicalRoleInterface return $this; } - /** - * Get the role name - * - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Set the role name. - * - * @param string $name - * - * @return self - */ - public function setName($name) - { - $this->name = (string) $name; - return $this; - } - /** * Is this role the default one ? * diff --git a/tests/UnicaenAuthTest/Entity/Db/RoleTest.php b/tests/UnicaenAuthTest/Entity/Db/RoleTest.php index 6348c39..73a6bc4 100644 --- a/tests/UnicaenAuthTest/Entity/Db/RoleTest.php +++ b/tests/UnicaenAuthTest/Entity/Db/RoleTest.php @@ -41,12 +41,6 @@ class RoleTest extends PHPUnit_Framework_TestCase $this->assertEquals('content', $this->role->getRoleId()); } - public function testCanSetName() - { - $this->role->setName('content'); - $this->assertEquals('content', $this->role->getName()); - } - public function testCanSetIsDefault() { $this->role->setIsDefault(true); -- GitLab