action.php 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. require_once __DIR__.SLASH.'ActiveDirectoryGroup.class.php';
  3. global $_,$conf,$myUser;
  4. switch($_['action']){
  5. case 'activedirectory_activedirectory_settings_save':
  6. if($myUser->can('activedirectory','configure')){
  7. $conf->put('plugin_activedirectory_server',$_['ad-server']);
  8. $conf->put('plugin_activedirectory_port',$_['ad-port']);
  9. $conf->put('plugin_activedirectory_ssl_port',$_['ad-ssl-port']);
  10. $conf->put('plugin_activedirectory_user_root',$_['ad-user-root']);
  11. $conf->put('plugin_activedirectory_group_root',$_['ad-group-root']);
  12. $conf->put('plugin_activedirectory_domain',$_['ad-domain']);
  13. $conf->put('plugin_activedirectory_reader_login',$_['ad-reader-login']);
  14. $conf->put('plugin_activedirectory_reader_password',$_['ad-reader-password']);
  15. $conf->put('plugin_activedirectory_admin_login',$_['ad-admin-login']);
  16. $conf->put('plugin_activedirectory_admin_password',$_['ad-admin-password']);
  17. }
  18. header('location: setting.php?section=activedirectory&success=Configuration enregistrée');
  19. break;
  20. case 'activedirectory_activedirectory_save_link':
  21. Action::write(function(&$response){
  22. global $myUser,$_;
  23. if(!$myUser->can('activedirectory','edit')) throw new Exception("Permissions insuffisantes",403);
  24. if(!isset($_['ad-group']) || empty($_['ad-group'])) throw new Exception("Nom de groupe obligatoire");
  25. $item = ActiveDirectoryGroup::provide();
  26. $item->adgroup = $_['ad-group'];
  27. $item->rank = $_['ad-rank'];
  28. $item->firm = $_['ad-firm'];
  29. $item->save();
  30. });
  31. break;
  32. case 'activedirectory_activedirectory_edit_link':
  33. Action::write(function(&$response){
  34. global $myUser,$_;
  35. if(!$myUser->can('activedirectory','edit')) throw new Exception("Permissions insuffisantes",403);
  36. $adgroup = ActiveDirectoryGroup::getById($_['id']);
  37. $adgroup = $adgroup->toArray();
  38. $adgroup['ad-group'] = html_entity_decode($adgroup['adgroup']);
  39. $adgroup['ad-rank'] = html_entity_decode($adgroup['rank']);
  40. $adgroup['ad-firm'] = html_entity_decode($adgroup['firm']);
  41. $response = $adgroup;
  42. });
  43. break;
  44. case 'activedirectory_activedirectory_delete_link':
  45. global $_;
  46. if(!$myUser->can('activedirectory','delete')) throw new Exception("Permissions insuffisantes",403);
  47. ActiveDirectoryGroup::deleteById($_['groupId']);
  48. header('location: setting.php?section=activedirectory&info=Correspondance Groupe/Rang/Établissement supprimée');
  49. break;
  50. }