Skip to content

Commit

Permalink
Issue #2429931 by DMaester, jiff: Tie the user setting that enables S…
Browse files Browse the repository at this point in the history
…SO authentication to permission
  • Loading branch information
jiff authored and Balazs Dianiska committed Aug 18, 2015
1 parent 232b1a5 commit aa52c56
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion simplesamlphp_auth.module
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ function simplesamlphp_auth_permission() {
'title' => t('Administer simpleSAMLphp authentication'),
'restrict access' => TRUE,
),
'change saml authentication setting' => array(
'title' => t('Change SAML authentication setting for individual accounts'),
'description' => t('Allow users to enable or disable SAML authentication per user on user edit forms.'),
'restrict access' => TRUE,
),
);
}

Expand Down Expand Up @@ -282,7 +287,7 @@ function simplesamlphp_auth_form_alter(&$form, $form_state, $form_id) {
$form['links']['#markup'] = $link;
}

if ($form_id == 'user_register_form' || $form_id == 'user_profile_form') {
if (($form_id == 'user_register_form' || $form_id == 'user_profile_form') && user_access('change saml authentication setting')) {
$form['saml'] = array(
'#type' => 'checkbox',
'#title' => t('Enable this user to leverage SAML authentication'),
Expand Down

0 comments on commit aa52c56

Please sign in to comment.