diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2018-06-16 11:40:00 +0200 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2019-01-23 19:57:28 +0100 |
commit | 3b68f6ca727f52f9dc84fa1a134c092b44c49103 (patch) | |
tree | 2dd38ff1453ad3a0a4620a408cdb67a482ae2fc6 /app | |
parent | 3f7a28de8473db53b3de9e19d5e8e58b4e21090d (diff) | |
download | wallabag-3b68f6ca727f52f9dc84fa1a134c092b44c49103.tar.gz wallabag-3b68f6ca727f52f9dc84fa1a134c092b44c49103.tar.zst wallabag-3b68f6ca727f52f9dc84fa1a134c092b44c49103.zip |
Add ldap
Diffstat (limited to 'app')
-rw-r--r-- | app/AppKernel.php | 4 | ||||
-rw-r--r-- | app/DoctrineMigrations/Version20170710113900.php | 54 | ||||
-rw-r--r-- | app/config/parameters.yml.dist | 20 | ||||
-rw-r--r-- | app/config/security.yml | 2 |
4 files changed, 80 insertions, 0 deletions
diff --git a/app/AppKernel.php b/app/AppKernel.php index 40726f05..c4f465dc 100644 --- a/app/AppKernel.php +++ b/app/AppKernel.php | |||
@@ -42,6 +42,10 @@ class AppKernel extends Kernel | |||
42 | new OldSound\RabbitMqBundle\OldSoundRabbitMqBundle(), | 42 | new OldSound\RabbitMqBundle\OldSoundRabbitMqBundle(), |
43 | ]; | 43 | ]; |
44 | 44 | ||
45 | if (class_exists('FR3D\\LdapBundle\\FR3DLdapBundle')) { | ||
46 | $bundles[] = new FR3D\LdapBundle\FR3DLdapBundle(); | ||
47 | } | ||
48 | |||
45 | if (in_array($this->getEnvironment(), ['dev', 'test'], true)) { | 49 | if (in_array($this->getEnvironment(), ['dev', 'test'], true)) { |
46 | $bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle(); | 50 | $bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle(); |
47 | $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle(); | 51 | $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle(); |
diff --git a/app/DoctrineMigrations/Version20170710113900.php b/app/DoctrineMigrations/Version20170710113900.php new file mode 100644 index 00000000..7be83110 --- /dev/null +++ b/app/DoctrineMigrations/Version20170710113900.php | |||
@@ -0,0 +1,54 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Application\Migrations; | ||
4 | |||
5 | use Doctrine\DBAL\Migrations\AbstractMigration; | ||
6 | use Doctrine\DBAL\Schema\Schema; | ||
7 | use Symfony\Component\DependencyInjection\ContainerAwareInterface; | ||
8 | use Symfony\Component\DependencyInjection\ContainerInterface; | ||
9 | |||
10 | /** | ||
11 | * Added dn field on wallabag_users | ||
12 | */ | ||
13 | class Version20170710113900 extends AbstractMigration implements ContainerAwareInterface | ||
14 | { | ||
15 | /** | ||
16 | * @var ContainerInterface | ||
17 | */ | ||
18 | private $container; | ||
19 | |||
20 | public function setContainer(ContainerInterface $container = null) | ||
21 | { | ||
22 | $this->container = $container; | ||
23 | } | ||
24 | |||
25 | private function getTable($tableName) | ||
26 | { | ||
27 | return $this->container->getParameter('database_table_prefix').$tableName; | ||
28 | } | ||
29 | |||
30 | /** | ||
31 | * @param Schema $schema | ||
32 | */ | ||
33 | public function up(Schema $schema) | ||
34 | { | ||
35 | $usersTable = $schema->getTable($this->getTable('user')); | ||
36 | |||
37 | $this->skipIf($usersTable->hasColumn('dn'), 'It seems that you already played this migration.'); | ||
38 | |||
39 | $usersTable->addColumn('dn', 'text', [ | ||
40 | 'default' => null, | ||
41 | 'notnull' => false, | ||
42 | ]); | ||
43 | } | ||
44 | |||
45 | /** | ||
46 | * @param Schema $schema | ||
47 | */ | ||
48 | public function down(Schema $schema) | ||
49 | { | ||
50 | $usersTable = $schema->getTable($this->getTable('user')); | ||
51 | $usersTable->dropColumn('dn'); | ||
52 | } | ||
53 | } | ||
54 | |||
diff --git a/app/config/parameters.yml.dist b/app/config/parameters.yml.dist index 6b0cb8e8..cfd41b69 100644 --- a/app/config/parameters.yml.dist +++ b/app/config/parameters.yml.dist | |||
@@ -62,3 +62,23 @@ parameters: | |||
62 | redis_port: 6379 | 62 | redis_port: 6379 |
63 | redis_path: null | 63 | redis_path: null |
64 | redis_password: null | 64 | redis_password: null |
65 | |||
66 | # ldap configuration | ||
67 | # To enable, you need to require fr3d/ldap-bundle | ||
68 | ldap_enabled: false | ||
69 | ldap_host: localhost | ||
70 | ldap_port: 389 | ||
71 | ldap_tls: false | ||
72 | ldap_ssl: false | ||
73 | ldap_bind_requires_dn: true | ||
74 | ldap_base: dc=example,dc=com | ||
75 | ldap_manager_dn: ou=Manager,dc=example,dc=com | ||
76 | ldap_manager_pw: password | ||
77 | ldap_filter: (&(ObjectClass=Person)) | ||
78 | # optional (if null: no ldap user is admin) | ||
79 | ldap_admin_filter: (&(memberOf=ou=admins,dc=example,dc=com)(uid=%s)) | ||
80 | ldap_username_attribute: uid | ||
81 | ldap_email_attribute: mail | ||
82 | ldap_name_attribute: cn | ||
83 | # optional (default sets user as enabled unconditionally) | ||
84 | ldap_enabled_attribute: ~ | ||
diff --git a/app/config/security.yml b/app/config/security.yml index 02afc9ea..48fbb553 100644 --- a/app/config/security.yml +++ b/app/config/security.yml | |||
@@ -6,6 +6,7 @@ security: | |||
6 | ROLE_ADMIN: ROLE_USER | 6 | ROLE_ADMIN: ROLE_USER |
7 | ROLE_SUPER_ADMIN: [ ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH ] | 7 | ROLE_SUPER_ADMIN: [ ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH ] |
8 | 8 | ||
9 | # /!\ This list is modified in WallabagUserBundle when LDAP is enabled | ||
9 | providers: | 10 | providers: |
10 | administrators: | 11 | administrators: |
11 | entity: | 12 | entity: |
@@ -36,6 +37,7 @@ security: | |||
36 | pattern: ^/login$ | 37 | pattern: ^/login$ |
37 | anonymous: ~ | 38 | anonymous: ~ |
38 | 39 | ||
40 | # /!\ This section is modified in WallabagUserBundle when LDAP is enabled | ||
39 | secured_area: | 41 | secured_area: |
40 | pattern: ^/ | 42 | pattern: ^/ |
41 | form_login: | 43 | form_login: |