DivaCloud_Admin_LDAP_Auth - Version 1.0.0

Version Notes

TLS not tested yet

Only test openLDAP server but should work fine with other LDAP server (see parameters)

Download this release

Release Info

Developer DiVA-Cloud
Extension DivaCloud_Admin_LDAP_Auth
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

app/code/local/DivaCloud/Admin/Block/System/Config/Extension.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class DivaCloud_Admin_Block_System_Config_Extension
3
+ extends Mage_Adminhtml_Block_Abstract
4
+ implements Varien_Data_Form_Element_Renderer_Interface
5
+ {
6
+
7
+ /**
8
+ * Render fieldset html
9
+ *
10
+ * @param Varien_Data_Form_Element_Abstract $element
11
+ * @return string
12
+ */
13
+ public function render(Varien_Data_Form_Element_Abstract $element)
14
+ {
15
+ $html = '<div style="background:#EAF0EE;border:1px solid #CCCCCC;margin-bottom:10px;padding:10px 5px 5px 10px;">
16
+ <h4>About</h4>
17
+ <p>Extension to login admin users from Ldap
18
+ </p>
19
+ <br />
20
+ <h4>Configuration</h4>
21
+ <p>Go to: System >> Configuration >> Admin</p>
22
+ </div>';
23
+
24
+ return $html;
25
+ }
26
+ }
app/code/local/DivaCloud/Admin/Block/System/Config/Info.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class DivaCloud_Admin_Block_System_Config_Info
3
+ extends Mage_Adminhtml_Block_Abstract
4
+ implements Varien_Data_Form_Element_Renderer_Interface
5
+ {
6
+
7
+ /**
8
+ * Render fieldset html
9
+ *
10
+ * @param Varien_Data_Form_Element_Abstract $element
11
+ * @return string
12
+ */
13
+ public function render(Varien_Data_Form_Element_Abstract $element)
14
+ {
15
+ $html = '<div style="background:url(\'https://www.diva-cloud.com/sites/all/themes/divatheme/images/DIVA_MANAGER.png\') no-repeat scroll 15px center #EAF0EE;border:1px solid #CCCCCC;margin-bottom:10px;padding:10px 5px 5px 200px;">
16
+ <h4>DiVA</h4>
17
+ <p>Ldap DiVA integration</p>
18
+ <p>&nbsp;</p>
19
+ <p>&nbsp;</p>
20
+ <p>&nbsp;</p>
21
+ <p>&nbsp;</p>
22
+ </div>';
23
+
24
+ return $html;
25
+ }
26
+ }
app/code/local/DivaCloud/Admin/Helper/Data.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class DivaCloud_Admin_Helper_Data extends Mage_Core_Helper_Abstract
3
+ {
4
+ public function getConfig($field, $default = null){
5
+ $value = Mage::getStoreConfig('localeselector/option/'.$field);
6
+ if(!isset($value) or trim($value) == ''){
7
+ return $default;
8
+ }else{
9
+ return $value;
10
+ }
11
+ }
12
+
13
+ public function log($data){
14
+ if(is_array($data) || is_object($data)){
15
+ $data = print_r($data, true);
16
+ }
17
+ Mage::log($data, null, 'divacloud-ldap.log');
18
+ }
19
+ }
app/code/local/DivaCloud/Admin/Model/Session.php ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class DivaCloud_Admin_Model_Session extends Mage_Admin_Model_Session
3
+ {
4
+ protected static $ldaplink = null;
5
+ public $host;
6
+ public $version;
7
+ public $rootDn;
8
+ public $rootPassword;
9
+ public $userDn;
10
+ public $filter;
11
+ public $cmpAttr;
12
+ public $pwdAttr;
13
+ public $attr;
14
+ public $tls;
15
+ public $roleId;
16
+ public $actived;
17
+ public $data = array();
18
+ /*
19
+ * Override admin login
20
+ */
21
+ public function login($username, $password, $request = null)
22
+ {
23
+ if (empty($username) || empty($password)) {
24
+ Mage::getSingleton('core/session')->addSuccess('Vous devez spécifier un login/mdp définit.');
25
+ return false;
26
+ }
27
+ try {
28
+ $this->load_Parameters();
29
+ //IF DESACTIVED DO NORMAL AUTH
30
+ if (!$this->actived) //CHECK MAGENTO CONNECT
31
+ return parent::login($username, $password, $request);
32
+ $this->connect();
33
+ $ldap_user = $this->authentify($username, $password);
34
+ if (!is_a($ldap_user, 'DivaCloud_Admin_Model_Session')){
35
+ Mage::getSingleton('core/session')->addError('Utilisateur non autorisé.');
36
+ return false;
37
+ }else{
38
+ // Auth reussie
39
+ $user = Mage::getModel('admin/user');
40
+ $user->login($username, $password);
41
+ // Auth reussie on Magento (user & pass match)
42
+ if ($user->getId()) {// update user
43
+ $user->setUsername($username)
44
+ ->setFirstname($ldap_user->data[0]['givenname'][0])
45
+ ->setLastname($ldap_user->data[0]['sn'][0])
46
+ ->setEmail($ldap_user->data[0]['mail'][0])
47
+ ->setPassword($password)
48
+ ->save();
49
+ Mage::getSingleton('core/session')->addSuccess('Utilisateur mis à jour.');
50
+ $this->renewSession();
51
+ if (Mage::getSingleton('adminhtml/url')->useSecretKey())
52
+ Mage::getSingleton('adminhtml/url')->renewSecretUrls();
53
+ $this->setIsFirstPageAfterLogin(true);
54
+ $this->setUser($user);
55
+ $this->setAcl(Mage::getResourceModel('admin/acl')->loadAcl());
56
+ if ($requestUri = $this->_getRequestUri($request)) {
57
+ Mage::dispatchEvent('admin_session_user_login_success', array('user' => $user));
58
+ header('Location: ' . $requestUri);
59
+ exit;
60
+ }
61
+ }else{// N'existe pas dans magento, existe sur Ldap
62
+ try {
63
+ $exist = false;
64
+ //$admin->loadByEmail($email);
65
+ // test if a user already exists (check username)
66
+ $users = Mage::getModel('admin/user')->getCollection()->getData();
67
+ foreach($users as $userData=>$val){
68
+ if($val['username'] == $username)
69
+ $exist = true;
70
+ }
71
+ if ($exist){// update user
72
+ $user = Mage::getModel('admin/user')->load($val['user_id']);
73
+ $user->setUsername($username)
74
+ ->setFirstname($ldap_user->data[0][$this->attr['firstname']][0])
75
+ ->setLastname($ldap_user->data[0][$this->attr['lastname']][0])
76
+ ->setEmail($ldap_user->data[0][$this->attr['mail']][0])
77
+ ->setPassword($password)
78
+ ->save();
79
+ Mage::getSingleton('core/session')->addSuccess('Mot de passe mis à jour, mauvais mot de passe Magento');
80
+ }else{
81
+ // create user
82
+ $user = Mage::getModel('admin/user')
83
+ ->setData(array(
84
+ 'username' => $username,
85
+ 'firstname' => $ldap_user->data[0][$this->attr['firstname']][0],
86
+ 'lastname' => $ldap_user->data[0][$this->attr['lastname']][0],
87
+ 'email' => $ldap_user->data[0][$this->attr['mail']][0],
88
+ 'password' => $password,
89
+ 'is_active' => 1
90
+ ))->save();
91
+ Mage::getSingleton('core/session')->addSuccess('Utilisateur crée sur Magento');
92
+ $user->setRoleIds(array($this->roleId))
93
+ ->setRoleUserId($user->getUserId())
94
+ ->saveRelations();
95
+ }
96
+ // alter session
97
+ $user->login($username, $password);
98
+ $this->renewSession();
99
+ if (Mage::getSingleton('adminhtml/url')->useSecretKey())
100
+ Mage::getSingleton('adminhtml/url')->renewSecretUrls();
101
+ $this->setIsFirstPageAfterLogin(true);
102
+ $this->setUser($user);
103
+ $this->setAcl(Mage::getResourceModel('admin/acl')->loadAcl());
104
+ if ($requestUri = $this->_getRequestUri($request)) {
105
+ Mage::dispatchEvent('admin_session_user_login_success', array('user' => $user));
106
+ header('Location: ' . $requestUri);
107
+ exit;
108
+ }
109
+ } catch (Exception $e) {
110
+ echo $e->getMessage();
111
+ exit;
112
+ }
113
+ }
114
+ }
115
+ }catch (Mage_Core_Exception $e) {
116
+ Mage::dispatchEvent('admin_session_user_login_failed',
117
+ array('user_name' => $username, 'exception' => $e));
118
+ if ($request && !$request->getParam('messageSent')) {
119
+ Mage::getSingleton('adminhtml/session')->addError("DiVA".$e->getMessage());
120
+ $request->setParam('messageSent', true);
121
+ }
122
+ }
123
+ return $user;
124
+ }
125
+ private function load_Parameters(){
126
+ // 'cn=admin,dc=diva,dc=com';
127
+ $this->rootDn = trim(Mage::getStoreConfig('dcadmin/ldaplogin/rootdn'));
128
+ // '*******'
129
+ $this->rootPassword = Mage::getStoreConfig('dcadmin/ldaplogin/rootpassword');
130
+ //'ou=users,dc=diva,dc=com'
131
+ $this->userDn = trim(Mage::getStoreConfig('dcadmin/ldaplogin/userdn'));
132
+ // '(&(%s=%s)(groups=DiVA-magento-1))';
133
+ $this->filter = trim(Mage::getStoreConfig('dcadmin/ldaplogin/filter'));
134
+ // 'cn';
135
+ $this->cmpAttr = trim(Mage::getStoreConfig('dcadmin/ldaplogin/cmpattr'));
136
+ // 'ldap1'
137
+ $this->host = trim(Mage::getStoreConfig('dcadmin/ldaplogin/host'));
138
+ // '3'
139
+ $this->version = intval(trim(Mage::getStoreConfig('dcadmin/ldaplogin/version')));
140
+ // '389'
141
+ $this->port = intval(trim(Mage::getStoreConfig('dcadmin/ldaplogin/port')));
142
+ // false
143
+ $this->tls = intval(trim(Mage::getStoreConfig('dcadmin/ldaplogin/tls')));
144
+ // cn,givenname,mail,sn,displayname,userpassword
145
+ $this->attr = json_decode(trim(Mage::getStoreConfig('dcadmin/ldaplogin/attr')), true);
146
+ //default the role_id after each login 0 to disable
147
+ $this->roleId = intval(trim(Mage::getStoreConfig('dcadmin/ldaplogin/defaultroleid')));
148
+ //actived 1|0
149
+ $this->pwdAttr = trim(Mage::getStoreConfig('dcadmin/ldaplogin/passattr'));
150
+ //actived 1|0
151
+ $this->actived = trim(Mage::getStoreConfig('dcadmin/ldaplogin/activeldap'));
152
+ }
153
+ private function connect(){
154
+ $this->load_Parameters();
155
+ if (is_null(self::$ldaplink)){
156
+ if ($this->tls)
157
+ $url = 'ldaps://'.$this->host.'/';
158
+ else
159
+ $url = 'ldap://'.$this->host.'/';
160
+ self::$ldaplink = ldap_connect($url, $this->port);
161
+ }
162
+ if (!ldap_set_option(self::$ldaplink, LDAP_OPT_PROTOCOL_VERSION, $this->version))
163
+ die('AUTH_ADMIN ERROR : VERSION ERROR');
164
+ if (!ldap_bind(self::$ldaplink, $this->rootDn, $this->rootPassword))
165
+ die('AUTH_ADMIN ERROR : BIND ERROR');
166
+ }
167
+ public function get_Link(){
168
+ if(empty(self::$ldaplink))
169
+ $this->connect();
170
+ return self::$ldaplink;
171
+ }
172
+ public function is_Allowed($login){
173
+ $filter = sprintf($this->filter, $this->cmpAttr, $login);
174
+ $userDn = $this->cmpAttr.'='.$login.','.$this->userDn;
175
+ $data = ldap_search(self::$ldaplink, $userDn, $filter, array_values($this->attr));
176
+ if (!$data)
177
+ throw new Exception('AUTH_ADMIN ERROR : SEARCH ERROR');
178
+ $this->data = ldap_get_entries(self::$ldaplink, $data);
179
+ if ($this->data['count'] != 1)
180
+ return false;
181
+ return true;
182
+ }
183
+ public function authentify($login=null, $password=null){
184
+ if (is_null($login) || is_null($password))
185
+ return false;
186
+ try{
187
+ $userDn = $this->cmpAttr.'='.$login.','.$this->userDn;
188
+ if (ldap_compare($this->get_Link(), $userDn, $this->pwdAttr, $password)){
189
+ if ($this->is_Allowed($login))
190
+ return $this;
191
+ }
192
+ return false;
193
+ }catch(Exception $e){
194
+ return false;
195
+ }
196
+ }
197
+ public function get_Ldap_User_Attributs(){
198
+ foreach ($this->attr as $attr)
199
+ $ret[$attr] = $this->data[0][$attr][0];
200
+ return $ret;
201
+ }
202
+ }
app/code/local/DivaCloud/Admin/etc/adminhtml.xml ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" ?>
2
+ <config>
3
+ <acl>
4
+ <resources>
5
+ <admin>
6
+ <children>
7
+ <system>
8
+ <children>
9
+ <config>
10
+ <children>
11
+ <dcadmin translate="title" module="dcadmin">
12
+ <title>Ldap configuration</title>
13
+ <sort_order>100</sort_order>
14
+ </dcadmin>
15
+ <divacloudinfo translate="title" module="dcadmin">
16
+ <title>Ldap infos</title>
17
+ <sort_order>100</sort_order>
18
+ </divacloudinfo>
19
+ </children>
20
+ </config>
21
+ </children>
22
+ </system>
23
+ </children>
24
+ </admin>
25
+ </resources>
26
+ </acl>
27
+ </config>
app/code/local/DivaCloud/Admin/etc/config.xml ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <config>
3
+ <modules>
4
+ <DivaCloud_Admin>
5
+ <version>0.1.0</version>
6
+ </DivaCloud_Admin>
7
+ </modules>
8
+ <global>
9
+ <blocks>
10
+ <dcadmin>
11
+ <class>DivaCloud_Admin_Block</class>
12
+ </dcadmin>
13
+ </blocks>
14
+ <models>
15
+ <admin>
16
+ <rewrite>
17
+ <session>DivaCloud_Admin_Model_Session</session>
18
+ </rewrite>
19
+ </admin>
20
+ </models>
21
+ <helpers>
22
+ <dcadmin>
23
+ <class>DivaCloud_Admin_Helper</class>
24
+ </dcadmin>
25
+ </helpers>
26
+ </global>
27
+ <!-- <frontend>
28
+ <routers />
29
+ <events />
30
+ <translate />
31
+ <layout />
32
+ </frontend>-->
33
+ <default>
34
+ <adminhtml>
35
+ <acl>
36
+ <resources>
37
+ <all>
38
+ <title>Allow Everything</title>
39
+ </all>
40
+ <admin>
41
+ <children>
42
+ <dcadmin module="dcadmin">
43
+ <title>Ldap login</title>
44
+ <sort_order>10</sort_order>
45
+ </dcadmin>
46
+ <system>
47
+ <children>
48
+ <config>
49
+ <children>
50
+ <divacloudinfo>
51
+ <title>DiVA</title>
52
+ </divacloudinfo>
53
+ <dcadmin>
54
+ <title>DiVA tab</title>
55
+ </dcadmin>
56
+ </children>
57
+ </config>
58
+ </children>
59
+ </system>
60
+ </children>
61
+ </admin>
62
+ </resources>
63
+ </acl>
64
+ </adminhtml>
65
+ <dcadmin>
66
+ <ldaplogin>
67
+ <activeldap><![CDATA[1]]></activeldap>
68
+ <host><![CDATA[ldap1]]></host>
69
+ <version><![CDATA[3]]></version>
70
+ <port><![CDATA[389]]></port>
71
+ <tls><![CDATA[0]]></tls>
72
+ <rootdn><![CDATA[cn=admin,dc=diva,dc=com]]></rootdn>
73
+ <rootpassword><![CDATA[diva]]></rootpassword>
74
+ <userdn><![CDATA[ou=users,dc=diva,dc=com]]></userdn>
75
+ <filter><![CDATA[(&(%s=%s)(groups=DiVA-magento-1))]]></filter>
76
+ <cmpattr><![CDATA[cn]]></cmpattr>
77
+ <passattr><![CDATA[userPassword]]></passattr>
78
+ <attr><![CDATA[{"login":"cn","firstname":"givenname","mail":"mail","lastname":"sn"}]]></attr>
79
+ <defaultroleid><![CDATA[20]]></defaultroleid>
80
+ </ldaplogin>
81
+ </dcadmin>
82
+ </default>
83
+ </config>
app/code/local/DivaCloud/Admin/etc/system.xml ADDED
@@ -0,0 +1,166 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <divatab translate="label" module="dcadmin">
5
+ <label>DiVA-Cloud</label>
6
+ <sort_order>1</sort_order>
7
+ </divatab>
8
+ </tabs>
9
+ <sections>
10
+ <divacloudinfo translate="label" module="dcadmin">
11
+ <label>Login infos</label>
12
+ <tab>divatab</tab>
13
+ <frontend_type>text</frontend_type>
14
+ <sort_order>300</sort_order>
15
+ <show_in_default>1</show_in_default>
16
+ <show_in_website>1</show_in_website>
17
+ <show_in_store>1</show_in_store>
18
+ <groups>
19
+ <info>
20
+ <frontend_model>dcadmin/system_config_info</frontend_model>
21
+ <sort_order>10</sort_order>
22
+ <show_in_default>1</show_in_default>
23
+ <show_in_website>1</show_in_website>
24
+ <show_in_store>1</show_in_store>
25
+ </info>
26
+ </groups>
27
+ </divacloudinfo>
28
+ <dcadmin module="dcadmin">
29
+ <label>Module Ldap Configuration</label>
30
+ <tab>divatab</tab>
31
+ <frontend_type>text</frontend_type>
32
+ <sort_order>340</sort_order>
33
+ <show_in_default>1</show_in_default>
34
+ <show_in_website>1</show_in_website>
35
+ <show_in_store>1</show_in_store>
36
+ <groups>
37
+ <ldaplogin translate="label">
38
+ <label>Ldap Login Configuration</label>
39
+ <frontend_type>text</frontend_type>
40
+ <sort_order>10</sort_order>
41
+ <show_in_default>1</show_in_default>
42
+ <show_in_website>1</show_in_website>
43
+ <show_in_store>1</show_in_store>
44
+ <fields>
45
+ <activeldap translate="label">
46
+ <label>Enable Ldap login</label>
47
+ <frontend_type>select</frontend_type>
48
+ <source_model>adminhtml/system_config_source_yesno</source_model>
49
+ <sort_order>10</sort_order>
50
+ <show_in_default>1</show_in_default>
51
+ <show_in_website>1</show_in_website>
52
+ <show_in_store>1</show_in_store>
53
+ </activeldap>
54
+ <host translate="label">
55
+ <label>Host</label>
56
+ <frontend_type>text</frontend_type>
57
+ <sort_order>11</sort_order>
58
+ <show_in_default>1</show_in_default>
59
+ <show_in_website>1</show_in_website>
60
+ <show_in_store>1</show_in_store>
61
+ <comment><![CDATA[<b>Ex: </b> ldap.example.com ]]></comment>
62
+ </host>
63
+ <version translate="label">
64
+ <label>Protocol version</label>
65
+ <frontend_type>text</frontend_type>
66
+ <sort_order>12</sort_order>
67
+ <show_in_default>1</show_in_default>
68
+ <show_in_website>1</show_in_website>
69
+ <show_in_store>1</show_in_store>
70
+ <comment><![CDATA[<b>Ex: </b> 3 ]]></comment>
71
+ </version>
72
+ <port translate="label">
73
+ <label>Port</label>
74
+ <frontend_type>text</frontend_type>
75
+ <sort_order>13</sort_order>
76
+ <show_in_default>1</show_in_default>
77
+ <show_in_website>1</show_in_website>
78
+ <show_in_store>1</show_in_store>
79
+ <comment><![CDATA[<b>Ex: </b> 389 ]]></comment>
80
+ </port>
81
+ <tls translate="label">
82
+ <label>Enable TLS</label>
83
+ <frontend_type>select</frontend_type>
84
+ <source_model>adminhtml/system_config_source_yesno</source_model>
85
+ <sort_order>14</sort_order>
86
+ <show_in_default>1</show_in_default>
87
+ <show_in_website>1</show_in_website>
88
+ </tls>
89
+ <rootdn translate="label">
90
+ <label>rootDn</label>
91
+ <frontend_type>text</frontend_type>
92
+ <sort_order>15</sort_order>
93
+ <show_in_default>1</show_in_default>
94
+ <show_in_website>1</show_in_website>
95
+ <show_in_store>1</show_in_store>
96
+ <comment><![CDATA[<b>Ex: </b> cn=admin,dc=diva,dc=com ]]></comment>
97
+ </rootdn>
98
+ <rootpassword translate="label">
99
+ <label>rootPassword</label>
100
+ <frontend_type>text</frontend_type>
101
+ <sort_order>16</sort_order>
102
+ <show_in_default>1</show_in_default>
103
+ <show_in_website>1</show_in_website>
104
+ <show_in_store>1</show_in_store>
105
+ <comment><![CDATA[<b>Ex: </b> YourP455w0Rd ]]></comment>
106
+ </rootpassword>
107
+ <userdn translate="label">
108
+ <label>userDn</label>
109
+ <frontend_type>text</frontend_type>
110
+ <sort_order>17</sort_order>
111
+ <show_in_default>1</show_in_default>
112
+ <show_in_website>1</show_in_website>
113
+ <show_in_store>1</show_in_store>
114
+ <comment><![CDATA[<b>Ex: </b> ou=users,dc=diva,dc=com ]]></comment>
115
+ </userdn>
116
+ <filter translate="label">
117
+ <label>Filter</label>
118
+ <frontend_type>text</frontend_type>
119
+ <sort_order>18</sort_order>
120
+ <show_in_default>1</show_in_default>
121
+ <show_in_website>1</show_in_website>
122
+ <show_in_store>1</show_in_store>
123
+ <comment><![CDATA[<b>Ex: </b> (&(%s=%s)(groups=DiVA-magento-1)) ]]></comment>
124
+ </filter>
125
+ <cmpattr translate="label">
126
+ <label>Login attribute</label>
127
+ <frontend_type>text</frontend_type>
128
+ <sort_order>19</sort_order>
129
+ <show_in_default>1</show_in_default>
130
+ <show_in_website>1</show_in_website>
131
+ <show_in_store>1</show_in_store>
132
+ <comment><![CDATA[<b>Ex: </b> cn ]]></comment>
133
+ </cmpattr>
134
+ <passattr translate="label">
135
+ <label>Password attribute</label>
136
+ <frontend_type>text</frontend_type>
137
+ <sort_order>20</sort_order>
138
+ <show_in_default>1</show_in_default>
139
+ <show_in_website>1</show_in_website>
140
+ <show_in_store>1</show_in_store>
141
+ <comment><![CDATA[<b>Ex: </b> userPassword ]]></comment>
142
+ </passattr>
143
+ <attr translate="label">
144
+ <label>Compliant attributes</label>
145
+ <frontend_type>text</frontend_type>
146
+ <sort_order>21</sort_order>
147
+ <show_in_default>1</show_in_default>
148
+ <show_in_website>1</show_in_website>
149
+ <show_in_store>1</show_in_store>
150
+ <comment><![CDATA[<b>Ex: </b> cn,givenname,mail,sn,displayname,userpassword ]]></comment>
151
+ </attr>
152
+ <defaultroleid translate="label">
153
+ <label>Default role_id</label>
154
+ <frontend_type>text</frontend_type>
155
+ <sort_order>22</sort_order>
156
+ <show_in_default>1</show_in_default>
157
+ <show_in_website>1</show_in_website>
158
+ <show_in_store>1</show_in_store>
159
+ <comment><![CDATA[<b>Ex: </b> 20 ]]></comment>
160
+ </defaultroleid>
161
+ </fields>
162
+ </ldaplogin>
163
+ </groups>
164
+ </dcadmin>
165
+ </sections>
166
+ </config>
app/etc/modules/DivaCloud_Admin.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <DivaCloud_Admin>
5
+ <active>true</active>
6
+ <codePool>local</codePool>
7
+ </DivaCloud_Admin>
8
+ </modules>
9
+ </config>
package.xml ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>DivaCloud_Admin_LDAP_Auth</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license>GPL</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>This plug-in allows you to authenticate your backend user via an LDAP server.</summary>
10
+ <description>Features: &#xD;
11
+ - Create user which not in Magento but have LDAP authorization&#xD;
12
+ - Update user properties with LDAP infos&#xD;
13
+ - Flexible Filter field&#xD;
14
+ - TLS support&#xD;
15
+ </description>
16
+ <notes>TLS not tested yet&#xD;
17
+ &#xD;
18
+ Only test openLDAP server but should work fine with other LDAP server (see parameters)</notes>
19
+ <authors><author><name>DiVA-Cloud</name><user>kant1</user><email>support@diva-cloud.com</email></author></authors>
20
+ <date>2012-04-17</date>
21
+ <time>16:06:49</time>
22
+ <contents><target name="magelocal"><dir name="DivaCloud"><dir name="Admin"><dir name="Block"><dir name="System"><dir name="Config"><file name="Extension.php" hash="5292c752c00a536b24977893baccb60d"/><file name="Info.php" hash="87526d5165eada3d49fdd72d27c11e97"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="d052390a88d052fc86cf0d2673ef8ed2"/></dir><dir name="Model"><file name="Session.php" hash="bab6bf66875a6421e03f47e50b2bae89"/></dir><dir name="etc"><file name="adminhtml.xml" hash="32df770fe97c56fc35ae1f00e3d344bf"/><file name="config.xml" hash="ee882669766f65706de0cb2a27ba3af7"/><file name="system.xml" hash="76aadb14e6303697a94aa94f26477bd6"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="DivaCloud_Admin.xml" hash="eca4d83c50f7242bf54d55e1b6f0cefc"/></dir></target></contents>
23
+ <compatible/>
24
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php><extension><name>ldap</name><min>0.0.1</min><max>12.0.0</max></extension></required></dependencies>
25
+ </package>