Skip to content

Commit

Permalink
Adding an alert to notify users when ingestion has not been run. (#1389)
Browse files Browse the repository at this point in the history
* Add additional missing info user notifications

Adding an informational alert for when either ingestion or `acl-config` has
not been run.

This is to address:
https://app.asana.com/0/342819846538629/1185258719202835

* Update html/index.php

Co-authored-by: Jeffrey T. Palmer <jeffrey.t.palmer@gmail.com>

* Update html/index.php

Co-authored-by: Jeffrey T. Palmer <jeffrey.t.palmer@gmail.com>

* Update html/index.php

Co-authored-by: Jeffrey T. Palmer <jeffrey.t.palmer@gmail.com>

* Update html/index.php

Co-authored-by: Jeffrey T. Palmer <jeffrey.t.palmer@gmail.com>

Co-authored-by: Jeffrey T. Palmer <jeffrey.t.palmer@gmail.com>
  • Loading branch information
ryanrath and jtpalmer authored Jul 21, 2020
1 parent 0ec8aff commit 1941fb2
Showing 1 changed file with 25 additions and 8 deletions.
33 changes: 25 additions & 8 deletions html/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -235,16 +235,29 @@ function isReferrer($referrer)
<link rel="stylesheet" type="text/css" href="gui/css/LoginPrompt.css"/>
<?php endif; ?>

<?php
$realms = array_reduce(Realms::getRealms(), function ($carry, Realm $item) {
$carry [] = $item->getName();
return $carry;
}, array());
?>

<script type='text/javascript'>

<?php
$realms = array_reduce(Realms::getRealms(), function ($carry, Realm $item) {
$carry [] = $item->getName();
return $carry;
}, array());

if (count($realms) === 0) {
$code = <<<JS
Ext.onReady(function() {
Ext.MessageBox.alert(
'Invalid State Detected',
'This Open XDMoD installation is in an invalid state.<br/><br/>' +
'Before Open XDMoD can be utilized you must run ingestion at least once.<br/><br/>' +
'If ingestion has already been run then make sure that you have run the acl-config CLI application and that it has completed successfully.<br/><br/>' +
'<b>NOTE: Open XDMoD will not function correctly until this problem has been resolved.</b>'
);
});
JS;
print $code;
}

print "CCR.xdmod.publicUser = " . json_encode(!$userLoggedIn) . ";\n";

$tech_support_recipient = xd_utilities\getConfiguration('general', 'tech_support_recipient');
Expand Down Expand Up @@ -281,7 +294,11 @@ function ($item) {

print "CCR.xdmod.ui.rawDataAllowedRealms = " . json_encode($rawDataRealms) . ";\n";

print "CCR.xdmod.ui.disabledMenus = " . json_encode(Acls::getDisabledMenus($user, $realms)) . ";\n";
try {
print "CCR.xdmod.ui.disabledMenus = " . json_encode(Acls::getDisabledMenus($user, $realms)) . ";\n";
} catch (Exception $e) {
print "CCR.xdmod.ui.disabledMenus = [];\n";
}

if ($userLoggedIn) {
print "CCR.xdmod.ui.allRoles = " . json_encode($user->enumAllAvailableRoles()) . "\n";
Expand Down

0 comments on commit 1941fb2

Please sign in to comment.