|
@@ -77,84 +77,84 @@ |
|
|
block discarded – undo |
|
77
|
77
|
} |
|
78
|
78
|
|
|
79
|
79
|
switch ($operationMode) { |
|
80
|
|
- case OPERATION_MODE_EDIT: |
|
81
|
|
- $idp = $validator->IdP($_GET['inst_id']); |
|
82
|
|
- // editing IdPs is done from within the popup. When we're done, send the |
|
83
|
|
- // user back to the popup (append the result of the operation later) |
|
84
|
|
- $redirect_destination = "manageAdmins.inc.php?inst_id=" . $idp->identifier . "&"; |
|
85
|
|
- $mailaddress = abortOnBogusMail($newmailaddress, $redirect_destination); |
|
86
|
|
- // is the user primary admin of this IdP? |
|
87
|
|
- $is_owner = $idp->isPrimaryOwner($_SESSION['user']); |
|
88
|
|
- // check if he is (also) federation admin for the federation this IdP is in. His invitations have more blessing then. |
|
89
|
|
- $fedadmin = $userObject->isFederationAdmin($idp->federation); |
|
90
|
|
- // check if he is either one, if not, complain |
|
91
|
|
- if (!$is_owner && !$fedadmin) { |
|
92
|
|
- echo "<p>" . sprintf(_("Something's wrong... you are a %s admin, but not for the %s the requested %s belongs to!"), $uiElements->nomenclature_fed, $uiElements->nomenclature_fed, $uiElements->nomenclature_inst) . "</p>"; |
|
93
|
|
- exit(1); |
|
94
|
|
- } |
|
|
80
|
+ case OPERATION_MODE_EDIT: |
|
|
81
|
+ $idp = $validator->IdP($_GET['inst_id']); |
|
|
82
|
+ // editing IdPs is done from within the popup. When we're done, send the |
|
|
83
|
+ // user back to the popup (append the result of the operation later) |
|
|
84
|
+ $redirect_destination = "manageAdmins.inc.php?inst_id=" . $idp->identifier . "&"; |
|
|
85
|
+ $mailaddress = abortOnBogusMail($newmailaddress, $redirect_destination); |
|
|
86
|
+ // is the user primary admin of this IdP? |
|
|
87
|
+ $is_owner = $idp->isPrimaryOwner($_SESSION['user']); |
|
|
88
|
+ // check if he is (also) federation admin for the federation this IdP is in. His invitations have more blessing then. |
|
|
89
|
+ $fedadmin = $userObject->isFederationAdmin($idp->federation); |
|
|
90
|
+ // check if he is either one, if not, complain |
|
|
91
|
+ if (!$is_owner && !$fedadmin) { |
|
|
92
|
+ echo "<p>" . sprintf(_("Something's wrong... you are a %s admin, but not for the %s the requested %s belongs to!"), $uiElements->nomenclature_fed, $uiElements->nomenclature_fed, $uiElements->nomenclature_inst) . "</p>"; |
|
|
93
|
+ exit(1); |
|
|
94
|
+ } |
|
95
|
95
|
|
|
96
|
|
- $prettyprintname = $idp->name; |
|
97
|
|
- $newtoken = $mgmt->createToken($fedadmin, $mailaddress, $idp); |
|
98
|
|
- $loggerInstance->writeAudit($_SESSION['user'], "NEW", "IdP " . $idp->identifier . " - Token created for " . $mailaddress); |
|
99
|
|
- $introtext = sprintf(_("a %s of the %s %s \"%s\" has invited you to manage the %s together with him."), $uiElements->nomenclature_fed, CONFIG_CONFASSISTANT['CONSORTIUM']['display_name'], $uiElements->nomenclature_inst, $prettyprintname, $uiElements->nomenclature_inst) . " " . sprintf(_("This invitation is valid for 24 hours from now, i.e. until %s."), strftime("%x %X", time() + 86400)); |
|
100
|
|
- break; |
|
101
|
|
- case OPERATION_MODE_NEWUNLINKED: |
|
102
|
|
- $redirect_destination = "../overview_federation.php?"; |
|
103
|
|
- $mailaddress = abortOnBogusMail($newmailaddress, $redirect_destination); |
|
104
|
|
- // run an input check and conversion of the raw inputs... just in case |
|
105
|
|
- $newinstname = $validator->string($_POST['name']); |
|
106
|
|
- $newcountry = $validator->string($_POST['country']); |
|
107
|
|
- $new_idp_authorized_fedadmin = $userObject->isFederationAdmin($newcountry); |
|
108
|
|
- if ($new_idp_authorized_fedadmin !== TRUE) { |
|
109
|
|
- throw new Exception("Something's wrong... you want to create a new " . $uiElements->nomenclature_inst . ", but are not a " . $uiElements->nomenclature_fed . " admin for the " . $uiElements->nomenclature_fed . " it should be in!"); |
|
110
|
|
- } |
|
111
|
|
- $federation = $validator->Federation($newcountry); |
|
112
|
|
- $prettyprintname = $newinstname; |
|
113
|
|
- $introtext = sprintf(_("a %s %s has invited you to manage the future %s \"%s\" (%s)."), CONFIG_CONFASSISTANT['CONSORTIUM']['display_name'], $uiElements->nomenclature_fed, $uiElements->nomenclature_inst, $prettyprintname, $newcountry) . " " . sprintf(_("This invitation is valid for 24 hours from now, i.e. until %s."), strftime("%x %X", time() + 86400)); |
|
114
|
|
- // send the user back to his federation overview page, append the result of the operation later |
|
115
|
|
- // do the token creation magic |
|
116
|
|
- $newtoken = $mgmt->createToken(TRUE, $mailaddress, $newinstname, 0, $newcountry); |
|
117
|
|
- $loggerInstance->writeAudit($_SESSION['user'], "NEW", "IdP FUTURE - Token created for " . $mailaddress); |
|
118
|
|
- break; |
|
119
|
|
- case OPERATION_MODE_NEWFROMDB: |
|
120
|
|
- $redirect_destination = "../overview_federation.php?"; |
|
121
|
|
- $mailaddress = abortOnBogusMail($newmailaddress, $redirect_destination); |
|
122
|
|
- // a real external DB entry was submitted and all the required parameters are there |
|
123
|
|
- $newexternalid = $validator->string($_POST['externals']); |
|
124
|
|
- $extinfo = $catInstance->getExternalDBEntityDetails($newexternalid); |
|
125
|
|
- $new_idp_authorized_fedadmin = $userObject->isFederationAdmin($extinfo['country']); |
|
126
|
|
- if ($new_idp_authorized_fedadmin !== TRUE) { |
|
127
|
|
- throw new Exception("Something's wrong... you want to create a new " . $uiElements->nomenclature_inst . ", but are not a " . $uiElements->nomenclature_fed . " admin for the " . $uiElements->nomenclature_fed . " it should be in!"); |
|
128
|
|
- } |
|
129
|
|
- $federation = $validator->Federation($extinfo['country']); |
|
130
|
|
- $newcountry = $extinfo['country']; |
|
131
|
|
- // see if the inst name is defined in the currently set language; if not, pick its English name; if N/A, pick the last in the list |
|
132
|
|
- $prettyprintname = ""; |
|
133
|
|
- foreach ($extinfo['names'] as $lang => $name) { |
|
134
|
|
- if ($lang == $languageInstance->getLang()) { |
|
135
|
|
- $prettyprintname = $name; |
|
|
96
|
+ $prettyprintname = $idp->name; |
|
|
97
|
+ $newtoken = $mgmt->createToken($fedadmin, $mailaddress, $idp); |
|
|
98
|
+ $loggerInstance->writeAudit($_SESSION['user'], "NEW", "IdP " . $idp->identifier . " - Token created for " . $mailaddress); |
|
|
99
|
+ $introtext = sprintf(_("a %s of the %s %s \"%s\" has invited you to manage the %s together with him."), $uiElements->nomenclature_fed, CONFIG_CONFASSISTANT['CONSORTIUM']['display_name'], $uiElements->nomenclature_inst, $prettyprintname, $uiElements->nomenclature_inst) . " " . sprintf(_("This invitation is valid for 24 hours from now, i.e. until %s."), strftime("%x %X", time() + 86400)); |
|
|
100
|
+ break; |
|
|
101
|
+ case OPERATION_MODE_NEWUNLINKED: |
|
|
102
|
+ $redirect_destination = "../overview_federation.php?"; |
|
|
103
|
+ $mailaddress = abortOnBogusMail($newmailaddress, $redirect_destination); |
|
|
104
|
+ // run an input check and conversion of the raw inputs... just in case |
|
|
105
|
+ $newinstname = $validator->string($_POST['name']); |
|
|
106
|
+ $newcountry = $validator->string($_POST['country']); |
|
|
107
|
+ $new_idp_authorized_fedadmin = $userObject->isFederationAdmin($newcountry); |
|
|
108
|
+ if ($new_idp_authorized_fedadmin !== TRUE) { |
|
|
109
|
+ throw new Exception("Something's wrong... you want to create a new " . $uiElements->nomenclature_inst . ", but are not a " . $uiElements->nomenclature_fed . " admin for the " . $uiElements->nomenclature_fed . " it should be in!"); |
|
136
|
110
|
} |
|
137
|
|
- } |
|
138
|
|
- if ($prettyprintname == "" && isset($extinfo['names']['en'])) { |
|
139
|
|
- $prettyprintname = $extinfo['names']['en']; |
|
140
|
|
- } |
|
141
|
|
- if ($prettyprintname == "") { |
|
142
|
|
- foreach ($extinfo['names'] as $name) { |
|
143
|
|
- $prettyprintname = $name; |
|
|
111
|
+ $federation = $validator->Federation($newcountry); |
|
|
112
|
+ $prettyprintname = $newinstname; |
|
|
113
|
+ $introtext = sprintf(_("a %s %s has invited you to manage the future %s \"%s\" (%s)."), CONFIG_CONFASSISTANT['CONSORTIUM']['display_name'], $uiElements->nomenclature_fed, $uiElements->nomenclature_inst, $prettyprintname, $newcountry) . " " . sprintf(_("This invitation is valid for 24 hours from now, i.e. until %s."), strftime("%x %X", time() + 86400)); |
|
|
114
|
+ // send the user back to his federation overview page, append the result of the operation later |
|
|
115
|
+ // do the token creation magic |
|
|
116
|
+ $newtoken = $mgmt->createToken(TRUE, $mailaddress, $newinstname, 0, $newcountry); |
|
|
117
|
+ $loggerInstance->writeAudit($_SESSION['user'], "NEW", "IdP FUTURE - Token created for " . $mailaddress); |
|
|
118
|
+ break; |
|
|
119
|
+ case OPERATION_MODE_NEWFROMDB: |
|
|
120
|
+ $redirect_destination = "../overview_federation.php?"; |
|
|
121
|
+ $mailaddress = abortOnBogusMail($newmailaddress, $redirect_destination); |
|
|
122
|
+ // a real external DB entry was submitted and all the required parameters are there |
|
|
123
|
+ $newexternalid = $validator->string($_POST['externals']); |
|
|
124
|
+ $extinfo = $catInstance->getExternalDBEntityDetails($newexternalid); |
|
|
125
|
+ $new_idp_authorized_fedadmin = $userObject->isFederationAdmin($extinfo['country']); |
|
|
126
|
+ if ($new_idp_authorized_fedadmin !== TRUE) { |
|
|
127
|
+ throw new Exception("Something's wrong... you want to create a new " . $uiElements->nomenclature_inst . ", but are not a " . $uiElements->nomenclature_fed . " admin for the " . $uiElements->nomenclature_fed . " it should be in!"); |
|
144
|
128
|
} |
|
145
|
|
- } |
|
146
|
|
- // fill the rest of the text |
|
147
|
|
- $introtext = sprintf(_("a %s %s has invited you to manage the %s \"%s\"."), CONFIG_CONFASSISTANT['CONSORTIUM']['display_name'], $uiElements->nomenclature_fed, $uiElements->nomenclature_inst, $prettyprintname) . " " . sprintf(_("This invitation is valid for 24 hours from now, i.e. until %s."), strftime("%x %X", time() + 86400)); |
|
148
|
|
- // do the token creation magic |
|
149
|
|
- $newtoken = $mgmt->createToken(TRUE, $mailaddress, $prettyprintname, $newexternalid); |
|
150
|
|
- $loggerInstance->writeAudit($_SESSION['user'], "NEW", "IdP FUTURE - Token created for " . $mailaddress); |
|
151
|
|
- break; |
|
152
|
|
- default: // includes OPERATION_MODE_INVALID |
|
153
|
|
- $wrongcontent = print_r($_POST, TRUE); |
|
154
|
|
- echo "<pre>Wrong parameters in POST: |
|
|
129
|
+ $federation = $validator->Federation($extinfo['country']); |
|
|
130
|
+ $newcountry = $extinfo['country']; |
|
|
131
|
+ // see if the inst name is defined in the currently set language; if not, pick its English name; if N/A, pick the last in the list |
|
|
132
|
+ $prettyprintname = ""; |
|
|
133
|
+ foreach ($extinfo['names'] as $lang => $name) { |
|
|
134
|
+ if ($lang == $languageInstance->getLang()) { |
|
|
135
|
+ $prettyprintname = $name; |
|
|
136
|
+ } |
|
|
137
|
+ } |
|
|
138
|
+ if ($prettyprintname == "" && isset($extinfo['names']['en'])) { |
|
|
139
|
+ $prettyprintname = $extinfo['names']['en']; |
|
|
140
|
+ } |
|
|
141
|
+ if ($prettyprintname == "") { |
|
|
142
|
+ foreach ($extinfo['names'] as $name) { |
|
|
143
|
+ $prettyprintname = $name; |
|
|
144
|
+ } |
|
|
145
|
+ } |
|
|
146
|
+ // fill the rest of the text |
|
|
147
|
+ $introtext = sprintf(_("a %s %s has invited you to manage the %s \"%s\"."), CONFIG_CONFASSISTANT['CONSORTIUM']['display_name'], $uiElements->nomenclature_fed, $uiElements->nomenclature_inst, $prettyprintname) . " " . sprintf(_("This invitation is valid for 24 hours from now, i.e. until %s."), strftime("%x %X", time() + 86400)); |
|
|
148
|
+ // do the token creation magic |
|
|
149
|
+ $newtoken = $mgmt->createToken(TRUE, $mailaddress, $prettyprintname, $newexternalid); |
|
|
150
|
+ $loggerInstance->writeAudit($_SESSION['user'], "NEW", "IdP FUTURE - Token created for " . $mailaddress); |
|
|
151
|
+ break; |
|
|
152
|
+ default: // includes OPERATION_MODE_INVALID |
|
|
153
|
+ $wrongcontent = print_r($_POST, TRUE); |
|
|
154
|
+ echo "<pre>Wrong parameters in POST: |
|
155
|
155
|
" . htmlspecialchars($wrongcontent) . " |
|
156
|
156
|
</pre>"; |
|
157
|
|
- exit(1); |
|
|
157
|
+ exit(1); |
|
158
|
158
|
} |
|
159
|
159
|
// are we on https? |
|
160
|
160
|
$proto = "http://"; |