diff --git a/htdocs/web_portal/controllers/site/edit_api_auth.php b/htdocs/web_portal/controllers/site/edit_api_auth.php
index e84c1b451..30398ee9f 100644
--- a/htdocs/web_portal/controllers/site/edit_api_auth.php
+++ b/htdocs/web_portal/controllers/site/edit_api_auth.php
@@ -1,10 +1,11 @@
getUserByPrinciple($dn);
- //Check the portal is not in read only mode, returns exception if it is and user is not an admin
+ /**
+ * Check the portal is not in read only mode,
+ * returns exception if it is and user is not an admin
+ */
checkPortalIsNotReadOnlyOrUserIsAdmin($user);
- if (!isset($_REQUEST['authentityid']) || !is_numeric($_REQUEST['authentityid']) ){
- throw new Exception("A authentication entity id must be specified in the url");
+ if (
+ !isset($_REQUEST['authentityid'])
+ || !is_numeric($_REQUEST['authentityid'])
+ ) {
+ throw new Exception(
+ "A authentication entity id must be specified in the url"
+ );
}
$serv = \Factory::getSiteService();
@@ -47,48 +62,67 @@ function edit_entity() {
// Validate the user has permission to edit properties
if (!$serv->userCanEditSite($user, $site)) {
- throw new \Exception("Permission denied: a site role is required to edit authentication entities at " . $site->getShortName());
+ throw new Exception(
+ "Permission denied: a site role is required to edit "
+ . "authentication entities at "
+ . $site->getShortName()
+ );
}
- if($_POST) { // If we receive a POST request it's to edit an authentication entity
+ // If we receive a POST request it's to edit an authentication entity
+ if ($_POST) {
submit($user, $authEnt, $site, $serv);
- } else { // If there is no post data, draw the edit authentication entity form
+ } else {
+ // If there is no post data, draw the edit authentication entity form
draw($user, $authEnt, $site);
}
}
-function draw(\User $user = null, \APIAuthentication $authEnt = null, \Site $site = null) {
- if(is_null($user)){
- throw new Exception("Unregistered users can't edit authentication credentials");
+function draw(
+ \User $user = null,
+ \APIAuthentication $authEnt = null,
+ \Site $site = null
+) {
+ if (is_null($user)) {
+ throw new Exception(
+ "Unregistered users can't edit authentication credentials"
+ );
}
$params = array();
$params['site'] = $site;
$params['authEnt'] = $authEnt;
$params['authTypes'] = array();
- $params['authTypes'][]='X.509';
- $params['authTypes'][]='OIDC Subject';
+ $params['authTypes'][] = 'X.509';
+ $params['authTypes'][] = 'OIDC Subject';
$params['user'] = $user;
show_view("site/edit_api_auth.php", $params);
+
die();
}
-function submit(\User $user, \APIAuthentication $authEnt, \Site $site, org\gocdb\services\Site $serv) {
+function submit(
+ \User $user,
+ \APIAuthentication $authEnt,
+ \Site $site,
+ org\gocdb\services\Site $serv
+) {
$newValues = getAPIAuthenticationFromWeb();
try {
$authEnt = $serv->editAPIAuthEntity($authEnt, $user, $newValues);
- } catch(Exception $e) {
+ } catch (Exception $e) {
show_view('error.php', $e->getMessage());
+
die();
}
$params = array();
$params['apiAuthenticationEntity'] = $authEnt;
$params['site'] = $site;
- show_view("site/edited_api_auth.php", $params);
- die();
+ show_view("site/edited_api_auth.php", $params);
+ die();
}
diff --git a/htdocs/web_portal/views/site/edit_api_auth.php b/htdocs/web_portal/views/site/edit_api_auth.php
index 9663b898b..3806076fa 100644
--- a/htdocs/web_portal/views/site/edit_api_auth.php
+++ b/htdocs/web_portal/views/site/edit_api_auth.php
@@ -1,6 +1,5 @@
getUser();
@@ -9,7 +8,6 @@
echo('');
if (!is_null($entUser)) {
-
echo('
");
- }
-
- } else {
- // This clause should be deleted or replaced with exception after all
- // authentication entities are assigned a user.
- echo('');
- echo("WARNING: editing will link user '");
- xecho($user->getFullname());
- echo("' to this credential. Click the browser Back button to cancel the edit.
");
+ }
+ } else {
+ /**
+ * This clause should be deleted or replaced with exception after
+ * all authentication entities are assigned a user.
+ */
+ echo('');
+ echo("WARNING: editing will link user '");
+ xecho($user->getFullname());
+ echo(
+ "' to this credential. Click the browser Back button "
+ . "to cancel the edit.
"
+ );
}
?>
-
diff --git a/htdocs/web_portal/views/site/edited_api_auth.php b/htdocs/web_portal/views/site/edited_api_auth.php
index 7e84ef18d..69782c257 100644
--- a/htdocs/web_portal/views/site/edited_api_auth.php
+++ b/htdocs/web_portal/views/site/edited_api_auth.php
@@ -1,7 +1,14 @@
Success
- The API authenication credential has now been updated. Type:getType()) ?>, identifier: getIdentifier()) ?>.
+ The API authenication credential has now been updated.
+ Type: getType()); ?>,
+ identifier: getIdentifier());
+ ?>.
-
- View site
+
getID();
+ ?>"
+ >View site
diff --git a/htdocs/web_portal/views/site/view_site.php b/htdocs/web_portal/views/site/view_site.php
index 6c0a5b24c..9089bbcbe 100644
--- a/htdocs/web_portal/views/site/view_site.php
+++ b/htdocs/web_portal/views/site/view_site.php
@@ -1,6 +1,7 @@
getId();
@@ -12,174 +13,270 @@
?>
-
+
+
-
Site: getShortName()) ?>
- getOfficialName()) ?>
- getDescription()) ?>
+
+ Site: getShortName()); ?>
+
+
+
+ getOfficialName()); ?>
+ getDescription()); ?>
-
+
-
-
@@ -218,59 +329,73 @@