Subversion Repositories ALCASAR

Rev

Rev 776 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 776 Rev 777
Line 56... Line 56...
56
*					Fichier ALCASAR_RADIUS_SITE						*
56
*					Fichier ALCASAR_RADIUS_SITE						*
57
*********************************************************************/
57
*********************************************************************/
58
$site = new siteConfig();
58
$site = new siteConfig();
59
$site->load(ALCASAR_RADIUS_SITE);
59
$site->load(ALCASAR_RADIUS_SITE);
60
if ($auth_enable == "1"){	//test $auth_enable
60
if ($auth_enable == "1"){	//test $auth_enable
-
 
61
	/*
-
 
62
	ON ACTIVE LE LDAP
-
 
63
	*/
-
 
64
	/*
-
 
65
	Configure autorize section with:
61
	#	ldap  { 
66
		ldap  { 
62
	#		fail=1
67
			fail=1
63
	#	}
68
		}
-
 
69
	*/
64
	if ($site->authorize->ldap !== false){
70
	if ($site->authorize->ldap === false){ // always test before update
65
		$site->authorize->addSection('ldap');
71
		$site->authorize->addSection('ldap');
66
		$site->authorize->ldap->addPair('fail','1');
72
		$site->authorize->ldap->addPair('fail','1');
67
	}else{
73
	}else{
68
		if ($site->authorize->ldap->fail === false){
74
		if ($site->authorize->ldap->fail === false){ // always test before update
69
			$site->authorize->ldap->addPair('fail','1');
75
			$site->authorize->ldap->addPair('fail','1');
70
		}
76
		}
71
	}
77
	}
-
 
78
	/*
-
 
79
	Configure authenticate section with
72
	#	Auth-Type LDAP {
80
		Auth-Type LDAP {
73
	#		ldap
81
			ldap
74
	#	}
82
		}
-
 
83
	*/
75
	if ($site->authenticate->getSectionInstance('Auth-Type','LDAP')===false){
84
	if ($site->authenticate->getSectionInstance('Auth-Type','LDAP')===false){ // always test before update
76
		$site->authenticate->addSection('Auth-Type', 'LDAP');
85
		$site->authenticate->addSection('Auth-Type', 'LDAP');
77
		$site->authenticate->getSectionInstance('Auth-Type','LDAP')->addSection('ldap');
86
		$site->authenticate->getSectionInstance('Auth-Type','LDAP')->addSection('ldap');
78
	}
87
	}
79
} else {
88
} else {
80
		/*
89
	/*
81
		DESACTIVE LE LDAP
90
	ON DESACTIVE LE LDAP
82
		
91
	*/
-
 
92
	if ($site->authorize->ldap !== false){ // always test before update
-
 
93
		$site->authorize->deleteSection("ldap");
83
		
94
	}
-
 
95
	if ($site->authenticate->getSectionInstance('Auth-Type','LDAP')!==false){ // always test before update
-
 
96
		$site->authenticate->deleteSection('Auth-Type','LDAP');
84
		*/
97
	}
85
}
98
}
86
//Sauvegarde du /etc/raddb/sites-available/alcasar
99
//Sauvegarde du /etc/raddb/sites-available/alcasar
87
$site->save(ALCASAR_RADIUS_SITE);
100
$site->save(ALCASAR_RADIUS_SITE);
88
 
101
 
89
/********************************************************************
102
/********************************************************************
Line 104... Line 117...
104
	//sauvegarde du fichier /etc/raddb/modules/ldap
117
	//sauvegarde du fichier /etc/raddb/modules/ldap
105
	$ldap->save(ALCASAR_RADIUS_MODULE_LDAP);
118
	$ldap->save(ALCASAR_RADIUS_MODULE_LDAP);
106
}	//test $auth_enable
119
}	//test $auth_enable
107
 
120
 
108
/****************************************************************
121
/****************************************************************
109
*		Redémarage des service				*
122
*		Redémarage des service									*
110
*****************************************************************/
123
*****************************************************************/
111
 
124
 
112
if ($auth_enable == "1"){
125
if ($auth_enable == "1"){
113
	file_put_contents(ALCASAR_CONF_FILE, str_replace('LDAP=off', 'LDAP=on', file_get_contents(ALCASAR_CONF_FILE)));}
126
	file_put_contents(ALCASAR_CONF_FILE, str_replace('LDAP=off', 'LDAP=on', file_get_contents(ALCASAR_CONF_FILE)));}
114
else {
127
else {