diff --git a/data/schema.sql b/data/schema.sql index db3fa75c4d4ca9e6931eb1fe90cd14a17cbca45c..3cabd51d6b13a7ff98fd7ec96cc4918331386a9c 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 3ec1ec147c15b05831381bb9fb0f89409f7c6f89..4918ca6cdc08b72ed1bdddf51fb7876450fc5d7b 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 6348c39b9a9275f742550e7ea72b093e4387e706..73a6bc4c54a51ee1bf6b57036e665e097ac629cc 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);