Changeset 28534 for extensions/Ldap_Login/admin
- Timestamp:
- May 25, 2014, 6:52:42 PM (10 years ago)
- Location:
- extensions/Ldap_Login/admin
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/Ldap_Login/admin/configuration.php
r27284 r28534 12 12 $me = new Ldap(); 13 13 $me->load_config(); 14 $me->ldap_conn(); 14 15 //$me = get_plugin_data($plugin_id); 15 16 16 17 $template->assign('HOST', $me->config['host']); 17 18 $template->assign('BASEDN', $me->config['basedn']); // racine ! 19 $template->assign('USERSBRANCH',$me->config['usersbranch']); 20 $template->assign('GROUPBRANCH',$me->config['groupbranch']); 21 $template->assign('LD_SEARCH_USERS',$me->config['ld_search_users']); 22 $template->assign('LD_SEARCH_GROUPS',$me->config['ld_search_groups']); 18 23 $template->assign('PORT', $me->config['port']); 19 24 $template->assign('LD_ATTR', $me->config['ld_attr']); 25 $template->assign('LD_GROUP', $me->config['ld_group']); 20 26 $template->assign('LD_USE_SSL', $me->config['ld_use_ssl']); 21 27 $template->assign('LD_BINDPW', $me->config['ld_bindpw']); 22 28 $template->assign('LD_BINDDN', $me->config['ld_binddn']); 29 $template->assign('WEBMASTERS_GROUP', $me->config['webmasters_group']); 30 $template->assign('ADMINS_GROUP', $me->config['admins_group']); 23 31 24 32 if (isset($_POST['save'])){ 25 33 $me->config['host'] = $_POST['HOST']; 26 34 $me->config['basedn'] = $_POST['BASEDN']; 35 $me->config['usersbranch'] = $_POST['USERSBRANCH']; 36 $me->config['groupbranch'] = $_POST['GROUPBRANCH']; 27 37 $me->config['port'] = $_POST['PORT']; 28 38 $me->config['ld_attr'] = $_POST['LD_ATTR']; 39 $me->config['ld_group'] = $_POST['LD_GROUP']; 29 40 $me->config['ld_binddn'] = $_POST['LD_BINDDN']; 30 41 $me->config['ld_bindpw'] = $_POST['LD_BINDPW']; 42 43 $me->config['webmasters_group'] = $_POST['WEBMASTERS_GROUP']; 44 $me->config['admins_group'] = $_POST['ADMINS_GROUP']; 31 45 32 46 if (isset($_POST['LD_USE_SSL'])){ … … 34 48 } else { 35 49 $me->config['ld_use_ssl'] = False; 50 } 51 52 if (isset($_POST['LD_SEARCH_GROUPS'])){ 53 $me->config['ld_search_groups'] = True; 54 } else { 55 $me->config['ld_search_groups'] = False; 56 } 57 58 if (isset($_POST['LD_SEARCH_USERS'])){ 59 $me->config['ld_search_users'] = True; 60 } else { 61 $me->config['ld_search_users'] = False; 36 62 } 37 63 } … … 44 70 // Check LDAP configuration 45 71 if (isset($_POST['check_ldap'])){ 46 $check = $me->ldap_name($_POST['USERNAME']);47 $error = $me->check_ldap();72 #$check = $me->ldap_name($_POST['USERNAME']); 73 #$error = $me->check_ldap(); 48 74 49 if ($me->ldap_bind_as($_POST['USERNAME'],$_POST['PASSWORD'])){ 50 $template->assign('LD_CHECK_LDAP','<p style="color:green;">Configuration LDAP OK : '.$check.'</p>'); 75 if ($me->config['users_group']) { 76 if ($me->user_membership($_POST['USERNAME'],$me->ldap_group($me->config['users_group']))) { 77 if ($me->ldap_bind_as($_POST['USERNAME'],$_POST['PASSWORD'])){ 78 // search groups 79 $group_query = 'SELECT name, id FROM '.GROUPS_TABLE.';'; 80 $groups = pwg_query($group_query); 81 $sentence = ''; 82 83 foreach($groups as $group) { 84 if($me->user_membership($_POST['USERNAME'], $me->ldap_group($group['name']))) { 85 $sentence = $sentence . ', '.$group['name']; 86 } 87 } 88 $template->assign('LD_CHECK_LDAP','<p style="color:green;">Configuration LDAP OK : '.$_POST['USERNAME'].' is in users'.$sentence.' group(s) and can auth. He is a '.$me->ldap_status($_POST['USERNAME']).' user according to the plugin.</p>'); 89 } 90 else { 91 $template->assign('LD_CHECK_LDAP','<p style="color:red;">Error : test '.$me->config['uri'].' '.$me->ldap_name($_POST['USERNAME']).'</p>'); 92 } 93 } 51 94 } 52 95 else { 53 $template->assign('LD_CHECK_LDAP','<p style="color:red;">Error :'.$error.' test '.$me->config['uri'].' '.$check.'</p>'); 96 if ($me->ldap_bind_as($_POST['USERNAME'],$_POST['PASSWORD'])){ 97 // search groups 98 $group_query = 'SELECT name, id FROM '.GROUPS_TABLE.';'; 99 $groups = pwg_query($group_query); 100 $sentence = ''; 101 102 foreach($groups as $group) { 103 if($me->user_membership($_POST['USERNAME'], $me->ldap_group($group['name']))) { 104 $sentence = $sentence . ', '.$group['name']; 105 } 106 } 107 $template->assign('LD_CHECK_LDAP','<p style="color:green;">Configuration LDAP OK : '.$_POST['USERNAME'].' is in group(s) '.$sentence.' and can auth. He is a '.$me->ldap_status($_POST['USERNAME']).' user according to the plugin.</p>'); 108 } 109 else { 110 $template->assign('LD_CHECK_LDAP','<p style="color:red;">Error : test '.$me->config['uri'].' '.$me->ldap_name($_POST['USERNAME']).'</p>'); 111 } 54 112 } 55 113 } -
extensions/Ldap_Login/admin/configuration.tpl
r27036 r28534 37 37 <input type="text" id="port" name="PORT" value="{$PORT}" /> 38 38 </li> 39 </ul>39 40 40 <i>{'If empty, localhost and standard protocol ports will be used in configuration.'|@translate}</i> 41 </fieldset> 42 43 <fieldset class="mainConf"> 44 <legend>{'Ldap attributes'|@translate}</legend> 45 <ul> 41 46 42 <li> 47 43 <label for="basedn">{'Base DN'|@translate}</label> … … 49 45 <input size="70" type="text" id="basedn" name="BASEDN" value="{$BASEDN}" /> 50 46 </li> 47 </ul> 51 48 49 </fieldset> 50 51 <fieldset class="mainConf"> 52 <legend>{'Ldap users'|@translate}</legend> 53 <ul> 54 <li> 55 <label for="usersbranch">{'Users Branch'|@translate}</label> 56 <br> 57 <input size="70" type="text" id="usersbranch" name="USERSBRANCH" value="{$USERSBRANCH}" /> 58 </li> 59 60 <li> 61 <label for="ld_search_users"> 62 {if $LD_SEARCH_USERS } 63 <input type="checkbox" id="ld_search_users" name="LD_SEARCH_USERS" value="{$LD_SEARCH_USERS}" checked /> 64 {else} 65 <input type="checkbox" id="ld_search_users" name="LD_SEARCH_USERS" value="{$LD_SEARCH_USERS}" /> 66 {/if} 67 {'Search Ldap users ?'|@translate}</label> 68 </li> 69 52 70 <li> 53 71 <label for="ld_attr">{'Attribute corresponding to the user name'|@translate}</label> 54 72 <br> 55 73 <input type="text" id="ld_attr" name="LD_ATTR" value="{$LD_ATTR}" /> 74 </li> 75 </ul> 76 </fieldset> 77 78 <fieldset class="mainConf"> 79 <legend>{'Ldap groups'|@translate}</legend> 80 81 <p><i>{'If you create a <a href="admin.php?page=group_list">piwigo group</a> with the same name as an ldap one, all members of the ldap group will automatically join the piwigo group at their next authentication. This allows you to create <a href="admin.php?page=help§ion=groups">specific right access management</a> (restrict access to a particaular album...).'|@translate}</i></p> 82 <ul> 83 84 <li> 85 <label for="groupbranch">{'Groups Branch'|@translate}</label> 86 <br> 87 <input size="70" type="text" id="groupbranch" name="GROUPBRANCH" value="{$GROUPBRANCH}" /> 88 </li> 89 90 <li> 91 <label for="ld_search_groups"> 92 {if $LD_SEARCH_GROUPS } 93 <input type="checkbox" id="ld_search_groups" name="LD_SEARCH_GROUPS" value="{$LD_SEARCH_GROUPS}" checked /> 94 {else} 95 <input type="checkbox" id="ld_search_groups" name="LD_SEARCH_GROUPS" value="{$LD_SEARCH_GROUPS}" /> 96 {/if} 97 {'Search Ldap groups ?'|@translate}</label> 98 </li> 99 100 <li> 101 <label for="ld_attr">{'Attribute corresponding to the group name'|@translate}</label> 102 <br> 103 <input type="text" id="ld_group" name="LD_GROUP" value="{$LD_GROUP}" /> 104 </li> 105 <br> 106 107 <li> 108 <label for="webmasters_group">{'Webmasters group'|@translate}</label> 109 <br> 110 {'Users members of this ldap group are granted piwigo webmasters.'|@translate}<br> 111 <input size="70" type="text" id="webmasters_group" name="WEBMASTERS_GROUP" value="{$WEBMASTERS_GROUP}" /> 112 </li> 113 114 <li> 115 <label for="admins_group">{'Admins group'|@translate}</label> 116 <br> 117 {'Users members of this ldap group are granted piwigo admins.'|@translate}<br> 118 <input size="70" type="text" id="admins_group" name="ADMINS_GROUP" value="{$ADMINS_GROUP}" /> 119 120 <br><br> 121 122 {'To get them out of these roles, they must be sorted of the ldap group and then role updated in the <a href="admin.php?page=user_list">piwigo admin</a>. If a group is mandatory as described in the <a href="admin.php?page=plugin-Ldap_Login-newusers">new piwigo users tab</a>, then they must also belong to the users group.'|@translate} 56 123 </li> 57 124 </ul> -
extensions/Ldap_Login/admin/newusers.php
r27284 r28534 17 17 $template->assign('SEND_CASUAL_MAIL', $me->config['send_password_by_mail_ldap']); 18 18 19 $template->assign('USERS_GROUP', $me->config['users_group']); 20 19 21 if (isset($_POST['save'])){ 22 23 $me->config['users_group'] = $_POST['USERS_GROUP']; 20 24 21 25 if (isset($_POST['ALLOW_NEWUSERS'])){ -
extensions/Ldap_Login/admin/newusers.tpl
r27036 r28534 28 28 {'Do you allow new piwigo users to be created when users authenticate succesfully on the ldap ?'|@translate} 29 29 </p> 30 30 31 <p> 32 <b><label for="users_group">{'Users group'|@translate}</label></b> 33 <br> 34 {'Users members of this ldap group (e.g.: piwigo,users ... , default is void ) can authenticate on piwigo and are created if the option above is selected. If left blank, everyone can authenticate.'|@translate} 35 <input size="70" type="text" id="users_group" name="USERS_GROUP" value="{$USERS_GROUP}" /> 36 </p> 37 31 38 <p> 32 39 {if $ADVERTISE_ADMINS} … … 48 55 49 56 </fieldset> 50 57 51 58 <p> 52 59 <input type="submit" value="{'Save'|@translate}" name="save" />
Note: See TracChangeset
for help on using the changeset viewer.