1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
<?php
// $Id$
/**
* Implementation of hook_help().
*/
function authfas_help($path, $arg) {
$output = '';
switch ($path) {
case "admin/help#authfas":
$output = '<p>'. t("Authentication to the Fedora Account System (FAS)") .'</p>';
$output .= '<p><em>'. t("Note that this module doesn't actually function yet.") .'</em></p>';
break;
}
return $output;
} // function authfas_help
/**
* Implementation of hook_perm().
*/
function authfas_perm() {
return array('administer FAS settings');
} // function authfas_perm()
/**
* Implementation of hook_block().
*/
function authfas_block($op = 'list', $delta = 0, $edit = array()) {
// DUMMY
if ($op == "list") {
$block = array();
$block[0]["info"] = t('AuthFAS success');
return $block;
}
else if ($op == "view") {
$fasurl = variable_get('authfas_fasurl', 'WHOOPS');
$block_content = '';
$block_content .= $fasurl;
$block = array();
$block['subject'] = 'FAS URL';
$block['content'] = $block_content;
return $block;
}
}
/**
* Implementation of hook_admin().
*/
function authfas_admin() {
$form = array();
$form['authfas_fasurl'] = array(
'#type' => 'textfield',
'#title' => t('Location of FAS instance'),
'#default_value' => variable_get('authfas_fasurl', 'admin.fedoraproject.org/accounts'),
'#size' => 50,
'#maxlength' => 255,
'#description' => t('The location of the FAS instance to which users can authenticate'),
'#required' => TRUE,
);
// We have a required setting for the Authenticated User role.
$form['authfas_authuser_fasgroup'] = array(
'#type' => 'textfield',
'#title' => t('FAS group for authenticated users'),
'#default_value' => variable_get('authfas_authuser_fasgroup', ''),
'#size' => 50,
'#maxlength' => 255,
'#description' => t('To authenticate when this module is enabled, a user must be a member of this FAS group.'),
'#required' => TRUE,
);
$form['authfas_more_information'] = array(
'#type' => 'item',
'#title' => t('More information'),
'#description' => t('Visit the <a href="@roles">Roles</a> settings page to set FAS group mappings for specific roles.', array('@roles' => url('admin/user/roles'))),
);
return system_settings_form($form);
}
/**
* Implementation of hook_menu().
*/
function authfas_menu() {
$items = array();
$items['admin/settings/authfas'] = array(
'#title' => 'AuthFAS module settings',
'#description' => 'Settings for authenticating to a FAS instance',
'#page_callback' => 'drupal_get_form',
'#page_arguments' => array('authfas_admin'),
'#access_arguments' => array('access administration pages'),
'#type' => MENU_NORMAL_ITEM,
);
return $items;
}
/**
* Validate settings entered in AuthFAS settings menu
*/
function authfas_admin_validate($form, &$form_state) {
// This is where we would validate the menu settings above
// http://drupal.org/node/206761
return TRUE;
}
function user_admin_role_form_alter(&$form, $form_state, $form_id) {
if ($form_id == "user_admin_role") {
form['foo'] = array('#title' => t('FOO'),);
}
}
|