Skip to content
Snippets Groups Projects
Commit 87b6f3a7 authored by Laurent Lecluse's avatar Laurent Lecluse
Browse files

Ajout du champ permettant de gérer les filtres LDAP au modèle et à l'entité Role

Refactoring
parent 29acec33
No related branches found
No related tags found
No related merge requests found
......@@ -5,14 +5,13 @@ namespace UnicaenAuth;
use Zend\ModuleManager\Feature\AutoloaderProviderInterface;
use Zend\ModuleManager\Feature\ConfigProviderInterface;
use Zend\ModuleManager\Feature\ServiceProviderInterface;
use Zend\ModuleManager\Feature\ViewHelperProviderInterface;
/**
* Point d'entrée du module d'authentification Unicaen.
*
* @author Bertrand GAUTHIER <bertrand.gauthier@unicaen.fr>
*/
class Module implements ConfigProviderInterface, ViewHelperProviderInterface, ServiceProviderInterface
class Module implements ConfigProviderInterface, ServiceProviderInterface
{
/**
*
......@@ -113,29 +112,6 @@ class Module implements ConfigProviderInterface, ViewHelperProviderInterface, Se
}
}
/**
*
* @return array
* @see ViewHelperProviderInterface
*/
public function getViewHelperConfig()
{
return [
'factories' => [
'userConnection' => 'UnicaenAuth\View\Helper\UserConnectionFactory',
'userCurrent' => 'UnicaenAuth\View\Helper\UserCurrentFactory',
'userStatus' => 'UnicaenAuth\View\Helper\UserStatusFactory',
'userProfile' => 'UnicaenAuth\View\Helper\UserProfileFactory',
'userInfo' => 'UnicaenAuth\View\Helper\UserInfoFactory',
'userProfileSelect' => 'UnicaenAuth\View\Helper\UserProfileSelectFactory',
'userProfileSelectRadioItem' => 'UnicaenAuth\View\Helper\UserProfileSelectRadioItemFactory',
],
'invokables' => [
'appConnection' => 'UnicaenAuth\View\Helper\AppConnection',
],
];
}
/**
*
* @return array
......
......@@ -93,7 +93,7 @@ $bjyauthorize = [
*/
'UnicaenAuth\Provider\Role\Config' => [
'guest' => ['name' => "Non authentifié(e)", 'selectable' => false, 'children' => [
'user' => ['name' => "Authentifié(e)", 'selectable' => false]
'user' => ['name' => "Authentifié(e)", 'selectable' => false],
]],
],
/**
......@@ -151,22 +151,22 @@ return [
'zfcuser_entity' => [
'class' => 'Doctrine\ORM\Mapping\Driver\AnnotationDriver',
'paths' => [
__DIR__ . '/../src/UnicaenAuth/Entity/Db'
]
__DIR__ . '/../src/UnicaenAuth/Entity/Db',
],
],
'orm_auth_driver' => [
'class' => 'Doctrine\ORM\Mapping\Driver\AnnotationDriver',
'cache' => 'array',
'paths' => [
__DIR__ . '/../src/UnicaenAuth/Entity/Db'
]
__DIR__ . '/../src/UnicaenAuth/Entity/Db',
],
],
'orm_default' => [
'class' => 'Doctrine\ORM\Mapping\Driver\DriverChain',
'drivers' => [
'UnicaenAuth\Entity\Db' => 'zfcuser_entity',
'UnicaenAuth\Entity\Db' => 'orm_auth_driver'
]
'UnicaenAuth\Entity\Db' => 'orm_auth_driver',
],
],
],
],
......@@ -179,7 +179,7 @@ return [
'UnicaenAuth\Authentication\Storage\Db' => 'UnicaenAuth\Authentication\Storage\Db',
'UnicaenAuth\Authentication\Storage\Ldap' => 'UnicaenAuth\Authentication\Storage\Ldap',
'UnicaenAuth\View\RedirectionStrategy' => 'UnicaenAuth\View\RedirectionStrategy',
'authUserContext' => 'UnicaenAuth\Service\UserContext'
'authUserContext' => 'UnicaenAuth\Service\UserContext',
],
'abstract_factories' => [
'UnicaenAuth\Authentication\Adapter\AbstractFactory',
......@@ -318,4 +318,19 @@ return [
],
],
],
'view_helpers' => [
'factories' => [
'userConnection' => 'UnicaenAuth\View\Helper\UserConnectionFactory',
'userCurrent' => 'UnicaenAuth\View\Helper\UserCurrentFactory',
'userStatus' => 'UnicaenAuth\View\Helper\UserStatusFactory',
'userProfile' => 'UnicaenAuth\View\Helper\UserProfileFactory',
'userInfo' => 'UnicaenAuth\View\Helper\UserInfoFactory',
'userProfileSelect' => 'UnicaenAuth\View\Helper\UserProfileSelectFactory',
'userProfileSelectRadioItem' => 'UnicaenAuth\View\Helper\UserProfileSelectRadioItemFactory',
],
'invokables' => [
'appConnection' => 'UnicaenAuth\View\Helper\AppConnection',
],
],
];
\ No newline at end of file
......@@ -14,6 +14,7 @@ CREATE TABLE IF NOT EXISTS `user_role` (
`role_id` VARCHAR(64) NOT NULL,
`is_default` TINYINT(1) NOT NULL DEFAULT 0,
`parent_id` INT(11) NULL DEFAULT NULL,
`ldap_filter` varchar(255) CHARACTER SET utf8 DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE INDEX `unique_role` (`role_id` ASC),
INDEX `idx_parent_id` (`parent_id` ASC),
......
......@@ -45,6 +45,12 @@ class Role implements HierarchicalRoleInterface
*/
protected $parent;
/**
* @var string
* @ORM\Column(name="ldap_filter", type="string", length=255, unique=true, nullable=true)
*/
protected $ldapFilter;
/**
* @var \Doctrine\Common\Collections\Collection
* @ORM\ManyToMany(targetEntity="UnicaenAuth\Entity\Db\User")
......@@ -55,6 +61,8 @@ class Role implements HierarchicalRoleInterface
*/
protected $users;
/**
* Get the id.
*
......@@ -65,6 +73,8 @@ class Role implements HierarchicalRoleInterface
return $this->id;
}
/**
* Set the id.
*
......@@ -75,9 +85,12 @@ class Role implements HierarchicalRoleInterface
public function setId($id)
{
$this->id = (int)$id;
return $this;
}
/**
* Get the role id.
*
......@@ -88,6 +101,8 @@ class Role implements HierarchicalRoleInterface
return $this->roleId;
}
/**
* Set the role id.
*
......@@ -98,9 +113,12 @@ class Role implements HierarchicalRoleInterface
public function setRoleId($roleId)
{
$this->roleId = (string)$roleId;
return $this;
}
/**
* Is this role the default one ?
*
......@@ -111,6 +129,8 @@ class Role implements HierarchicalRoleInterface
return $this->isDefault;
}
/**
* Set this role as the default one.
*
......@@ -121,9 +141,12 @@ class Role implements HierarchicalRoleInterface
public function setIsDefault($isDefault)
{
$this->isDefault = (boolean)$isDefault;
return $this;
}
/**
* Get the parent role
*
......@@ -134,6 +157,8 @@ class Role implements HierarchicalRoleInterface
return $this->parent;
}
/**
* Set the parent role.
*
......@@ -144,9 +169,36 @@ class Role implements HierarchicalRoleInterface
public function setParent(Role $parent)
{
$this->parent = $parent;
return $this;
}
/**
* @return string
*/
public function getLdapFilter()
{
return $this->ldapFilter;
}
/**
* @param string $ldapFilter
*
* @return Role
*/
public function setLdapFilter($ldapFilter)
{
$this->ldapFilter = $ldapFilter;
return $this;
}
/**
* Get users.
*
......@@ -157,6 +209,8 @@ class Role implements HierarchicalRoleInterface
return $this->users->getValues();
}
/**
* Add a user to the role.
*
......@@ -169,6 +223,8 @@ class Role implements HierarchicalRoleInterface
$this->users[] = $user;
}
/**
*
* @return string
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment