Skip to content

Commit

Permalink
Merge pull request #2096 from department-of-veterans-affairs/rc/2023-…
Browse files Browse the repository at this point in the history
…08-22/Sprint-59-c1

Rc/2023 08 22/sprint 59 c1
  • Loading branch information
Pelentan authored Aug 29, 2023
2 parents 81bb264 + cd4163a commit ecad2fb
Show file tree
Hide file tree
Showing 18 changed files with 1,202 additions and 1,022 deletions.
2 changes: 1 addition & 1 deletion LEAF_Nexus/sources/Employee.php
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@ public function importFromNational($userName)
$cacheHash = "lookupLogin{$userName}";
unset($this->cache[$cacheHash]);

$db_nat = new \Leaf\Db(DIRECTORY_HOST, DIRECTORY_USER, DIRECTORY_PASS, DIRECTORY_DB);
$db_nat = new Db(DIRECTORY_HOST, DIRECTORY_USER, DIRECTORY_PASS, DIRECTORY_DB);
$login_nat = new Login($db_nat, $db_nat);

$natEmployee = new NationalEmployee($db_nat, $login_nat);
Expand Down
22 changes: 22 additions & 0 deletions LEAF_Nexus/sources/Tag.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,26 @@ public function getAll()

return $res;
}

/**
* @param int $id
* @param string $tag
*
* @return array
*
* Created at: 8/16/2023, 8:57:05 AM (America/New_York)
*/
public function groupIsTagged(int $id, string $tag): array
{
$vars = array(':groupID' => $id,
':tag' => $tag);
$sql = 'SELECT `groupID`, `tag`
FROM `group_tags`
WHERE `groupID` = :groupID
AND `tag` = :tag';

$return_value = $this->db->pdo_select_query($sql, $vars);

return $return_value;
}
}
2 changes: 2 additions & 0 deletions LEAF_Request_Portal/admin/ajaxIndex.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ function checkToken()

break;
case 'remove_user_old':
// this should be deprecated as of 8/18/2023
checkToken();

$deleteList = Leaf\XSSHelpers::scrubObjectOrArray(json_decode($_POST['json'], true));
Expand All @@ -72,6 +73,7 @@ function checkToken()

break;
case 'remove_user':
// this should be deprecated as of 8/18/2023
checkToken();

$group = new Portal\Group($db, $login);
Expand Down
2 changes: 1 addition & 1 deletion LEAF_Request_Portal/admin/templates/main.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
<section class="usa-banner bg-orange-topbanner" aria-label="Official government website">
<header class="usa-banner__header">
<div class="grid-col-fill tablet:grid-col-auto">
<p class="usa-banner__header-text text-white">
<p class="usa-banner__header-text text-white lf-alert">
&nbsp;Do not enter PHI/PII
</p>
</div>
Expand Down
78 changes: 55 additions & 23 deletions LEAF_Request_Portal/admin/templates/mod_groups.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,18 @@ function pruneMember(groupID, userID) {
});
}
function reactivateMember(groupID, userID) {
$.ajax({
type: 'POST',
url: "../api/group/" + groupID + "/members/_" + userID + "/reactivate",
data: {'CSRFToken': '<!--{$CSRFToken}-->'},
fail: function(err) {
console.log(err);
},
cache: false
});
}
function addNexusMember(groupID, empUID) {
$.ajax({
type: 'POST',
Expand Down Expand Up @@ -383,31 +395,36 @@ function toTitleCase(str) {
}
function addAdmin(userID) {
$.ajax({
type: 'POST',
url: "ajaxIndex.php?a=add_user",
data: {'userID': userID,
'groupID': 1,
'CSRFToken': '<!--{$CSRFToken}-->'},
success: function(response) {
getMembers(1);
},
cache: false
});
if (userID === '') {
return;
} else {
$.ajax({
type: 'POST',
url: "../api/group/" + 1 + "/members",
data: {'userID': userID,
'CSRFToken': '<!--{$CSRFToken}-->'},
success: function(response) {
getMembers(1);
},
cache: false
});
}
}
function removeAdmin(userID) {
$.ajax({
type: 'POST',
url: "ajaxIndex.php?a=remove_user",
data: {'userID': userID,
'groupID': 1,
'CSRFToken': '<!--{$CSRFToken}-->'},
success: function(response) {
getMembers(1);
},
cache: false
});
if (userID === '') {
return;
} else {
$.ajax({
type: 'DELETE',
url: "../api/group/" + 1 + "/members/_" + userID + "?" +
$.param({'CSRFToken': '<!--{$CSRFToken}-->'}),
success: function(response) {
getMembers(1);
},
cache: false
});
}
}
function unsetPrimaryAdmin() {
Expand Down Expand Up @@ -515,7 +532,12 @@ function getGroupList() {
actions += '</td>';
employee_table += `<tr>${employeeName}${employeeUserName}${backups}${isLocal}${isRegional}${actions}</tr>`;
} else {
let pruneMemberButton = `<td style="font-size: 0.8em; text-align: center;"><button id="pruneMember_${counter}" class="usa-button usa-button--secondary leaf-btn-small leaf-font0-8rem" style="font-size: 0.8em; display: inline-block; float: left; margin: auto; min-width: 4rem;" title="Prune this user from this group">Prune</button>`;
let pruneMemberButton = '';
if (res[i].regionallyManaged === false) {
pruneMemberButton = `<td style="font-size: 0.8em; text-align: center;"><button id="pruneMember_${counter}" class="usa-button usa-button--secondary leaf-btn-small leaf-font0-8rem" style="font-size: 0.8em; display: inline-block; float: left; margin: auto; min-width: 4rem;" title="Prune this user from this group">Prune</button>`;
} else {
pruneMemberButton = `<td style="font-size: 0.8em; text-align: center;"><button id="reActivateMember_${counter}" class="usa-button usa-button leaf-btn-small leaf-font0-8rem" style="font-size: 0.8em; display: inline-block; float: left; margin: auto; min-width: 4rem;" title="Reactivate this user for this group">Reactivate</button>`;
}
let actions = `${pruneMemberButton}`;
actions += '</td>';
inactive_table += `<tr>${employeeName}${employeeUserName}${backups}${isLocal}${isRegional}${actions}</tr>`;
Expand Down Expand Up @@ -570,6 +592,16 @@ function getGroupList() {
});
dialog_confirm.show();
});
$('#reActivateMember_' + counter).on('click', function () {
dialog_confirm.setContent('Are you sure you want to Reactivate this member?');
dialog_confirm.setSaveHandler(function () {
reactivateMember(groupID, res[i].userName);
dialog_confirm.hide();
dialog.hide();
});
dialog_confirm.show();
});
}
counter++;
}
Expand Down
Loading

0 comments on commit ecad2fb

Please sign in to comment.