@@ -20,15 +20,18 @@ function _simplesaml_auth_login_register() {
20
20
// Get unique identifier from saml attributes.
21
21
$ authname = _simplesamlphp_auth_get_authname ();
22
22
23
- watchdog ('simplesamlphp_auth ' , 'Authname is [%authname] userid is [%uid] ' , array (
24
- '%authname ' => $ authname ,
25
- '%uid ' => $ user ->uid ,
26
- ), WATCHDOG_DEBUG );
27
-
23
+ if (variable_get ('simplesamlphp_auth_debug ' , 0 )) {
24
+ watchdog ('simplesamlphp_auth ' , 'Authname is [%authname] userid is [%uid] ' , array (
25
+ '%authname ' => $ authname ,
26
+ '%uid ' => $ user ->uid ,
27
+ ), WATCHDOG_DEBUG );
28
+ }
28
29
if (!empty ($ authname )) {
29
30
// User is logged in with SAML authentication and we got the unique
30
31
// identifier, so try to log into Drupal.
31
- watchdog ('simplesamlphp_auth ' , 'Loading Drupal user [%authname] ' , array ('%authname ' => $ authname ), WATCHDOG_DEBUG );
32
+ if (variable_get ('simplesamlphp_auth_debug ' , 0 )) {
33
+ watchdog ('simplesamlphp_auth ' , 'Loading Drupal user [%authname] ' , array ('%authname ' => $ authname ), WATCHDOG_DEBUG );
34
+ }
32
35
33
36
// Retrieve user mapping and attempt to log the user in.
34
37
$ ext_user = user_external_load ($ authname );
@@ -92,16 +95,20 @@ function _simplesaml_auth_user_register($authname) {
92
95
if (variable_get ('simplesamlphp_auth_registerusers ' , TRUE )) {
93
96
94
97
// We are allowed to register new users.
95
- watchdog ('simplesamlphp_auth ' , 'Register [%authname] ' , array ('%authname ' => $ authname ), WATCHDOG_DEBUG );
98
+ if (variable_get ('simplesamlphp_auth_debug ' , 0 )) {
99
+ watchdog ('simplesamlphp_auth ' , 'Register [%authname] ' , array ('%authname ' => $ authname ), WATCHDOG_DEBUG );
100
+ }
96
101
97
102
// It's possible that a user with this name already exists, but is not
98
103
// permitted to login to Drupal via SAML. If so, log out of SAML and
99
104
// redirect to the front page.
100
105
$ account = user_load_by_name ($ authname );
101
106
if ($ account ) {
102
- watchdog ('simplesamlphp_auth ' , 'User [%authname] could not be registered because that username already exists and is not SAML enabled. ' , array (
103
- '%authname ' => $ authname ,
104
- ), WATCHDOG_DEBUG );
107
+ if (variable_get ('simplesamlphp_auth_debug ' , 0 )) {
108
+ watchdog ('simplesamlphp_auth ' , 'User [%authname] could not be registered because that username already exists and is not SAML enabled. ' , array (
109
+ '%authname ' => $ authname ,
110
+ ), WATCHDOG_DEBUG );
111
+ }
105
112
106
113
drupal_set_message (t ('We are sorry, your user account is not SAML enabled. ' ));
107
114
$ _simplesamlphp_auth_as ->logout (base_path ());
@@ -112,10 +119,12 @@ function _simplesaml_auth_user_register($authname) {
112
119
// Register the new user.
113
120
user_external_login_register ($ authname , 'simplesamlphp_auth ' );
114
121
115
- watchdog ('simplesamlphp_auth ' , 'Registered [%authname] with uid @uid ' , array (
116
- '%authname ' => $ authname ,
117
- '@uid ' => $ user ->uid ,
118
- ), WATCHDOG_DEBUG );
122
+ if (variable_get ('simplesamlphp_auth_debug ' , 0 )) {
123
+ watchdog ('simplesamlphp_auth ' , 'Registered [%authname] with uid @uid ' , array (
124
+ '%authname ' => $ authname ,
125
+ '@uid ' => $ user ->uid ,
126
+ ), WATCHDOG_DEBUG );
127
+ }
119
128
120
129
if (!empty ($ user ->uid )) {
121
130
// Populate roles based on configuration setting.
@@ -149,7 +158,9 @@ function _simplesaml_auth_user_register($authname) {
149
158
* The user account object to update.
150
159
*/
151
160
function _simplesaml_auth_user_update ($ account ) {
152
- watchdog ('simplesamlphp_auth ' , 'Updating username [%acctname] ' , array ('%acctname ' => $ account ->name ), WATCHDOG_DEBUG );
161
+ if (variable_get ('simplesamlphp_auth_debug ' , 0 )) {
162
+ watchdog ('simplesamlphp_auth ' , 'Updating username [%acctname] ' , array ('%acctname ' => $ account ->name ), WATCHDOG_DEBUG );
163
+ }
153
164
154
165
db_update ('users ' )
155
166
->fields (array ('name ' => $ account ->name ))
@@ -165,7 +176,9 @@ function _simplesaml_auth_user_update($account) {
165
176
watchdog ('simplesamlphp_auth ' , $ e ->getMessage (), NULL , WATCHDOG_CRITICAL );
166
177
}
167
178
168
- watchdog ('simplesamlphp_auth ' , 'Updating mail [%mailaddr] ' , array ('%mailaddr ' => $ mail_address ), WATCHDOG_DEBUG );
179
+ if (variable_get ('simplesamlphp_auth_debug ' , 0 )) {
180
+ watchdog ('simplesamlphp_auth ' , 'Updating mail [%mailaddr] ' , array ('%mailaddr ' => $ mail_address ), WATCHDOG_DEBUG );
181
+ }
169
182
170
183
if (!empty ($ mail_address )) {
171
184
db_update ('users ' )
@@ -190,7 +203,9 @@ function _simplesaml_auth_user_login($ext_user) {
190
203
// See if we're supposed to re-evaluate role assignments.
191
204
if (variable_get ('simplesamlphp_auth_roleevaleverytime ' , 0 )) {
192
205
// Populate roles based on configuration setting.
193
- watchdog ('simplesamlphp_auth ' , 'User already registered [%authname] updating roles. ' , array ('%authname ' => $ ext_user ->name ), WATCHDOG_DEBUG );
206
+ if (variable_get ('simplesamlphp_auth_debug ' , 0 )) {
207
+ watchdog ('simplesamlphp_auth ' , 'User already registered [%authname] updating roles. ' , array ('%authname ' => $ ext_user ->name ), WATCHDOG_DEBUG );
208
+ }
194
209
$ roles = _simplesamlphp_auth_rolepopulation (variable_get ('simplesamlphp_auth_rolepopulation ' , '' ));
195
210
$ userinfo = array ('roles ' => $ roles );
196
211
0 commit comments