Commit c05f9a5c authored by Leigh B Stoller's avatar Leigh B Stoller
Browse files

Bunch of fixes for approving users to projects. I feel like I lost some

code cause I remember doing this already, but maybe that was another one
of my dreams (delusions).
parent 4a73b9ce
......@@ -422,7 +422,7 @@ function Do_EditMembership()
function Do_EditPrivs()
{
global $this_user, $target_group, $ajax_args;
global $newTrustMap, $TB_PROJECT_EDITGROUP;
global $newTrustMap, $TB_PROJECT_EDITGROUP, $TBADMINGROUP;
if (CheckPageArgs()) {
return;
......@@ -453,11 +453,24 @@ function Do_EditPrivs()
return -1;
}
$this_uid = $this_user->uid();
$user_uid = $target_user->uid_idx();
$user_uid = $target_user->uid();
$trust = $newTrustMap[$ajax_args["priv"]];
$pid = $target_group->pid();
$gid = $target_group->gid();
# Create the user if it is not yet approved.
if ($target_user->status() == TBDB_USERSTATUS_UNAPPROVED) {
$target_user->SetStatus(TBDB_USERSTATUS_ACTIVE);
$retval = SUEXEC($this_uid, $TBADMINGROUP,
"webtbacct add $user_uid",
SUEXEC_ACTION_CONTINUE);
if ($retval) {
$target_user->SetStatus(TBDB_USERSTATUS_UNAPPROVED);
SPITAJAX_ERROR(-1, "Internal error creating new user");
return;
}
}
$retval = SUEXEC($this_uid, $pid,
"webmodgroups -m $pid:$gid:$trust $user_uid",
SUEXEC_ACTION_CONTINUE);
......
......@@ -283,11 +283,13 @@ function (_, sup, moment, aptforms, mainString,
var callback = function(json) {
sup.HideWaitWait();
// Always reload.
LoadMembersTab();
if (json.code) {
sup.SpitOops("oops", json.value);
return;
}
LoadMembersTab();
}
sup.ShowWaitWait();
var xmlthing =
......@@ -307,11 +309,13 @@ function (_, sup, moment, aptforms, mainString,
var callback = function(json) {
sup.HideWaitWait();
// Always reload.
LoadMembersTab();
if (json.code) {
sup.SpitOops("oops", json.value);
return;
}
LoadMembersTab();
}
sup.ShowWaitWait("We are modifying privs ... patience please");
var xmlthing =
......@@ -342,12 +346,13 @@ function (_, sup, moment, aptforms, mainString,
var callback = function(json) {
sup.HideWaitWait();
// Always reload.
LoadMembersTab();
if (json.code) {
sup.SpitOops("oops", json.value);
LoadMembersTab();
return;
}
LoadMembersTab();
}
sup.ShowWaitWait("We are removing users from this group ... " +
"patience please");
......@@ -381,12 +386,13 @@ function (_, sup, moment, aptforms, mainString,
var callback = function(json) {
sup.HideWaitWait();
// Always reload.
LoadMembersTab();
if (json.code) {
sup.SpitOops("oops", json.value);
LoadMembersTab();
return;
}
LoadMembersTab();
}
sup.ShowWaitWait("We are adding users to this group ... " +
"patience please");
......
......@@ -329,15 +329,6 @@ function (_, sup, moment, mainString,
$(this).html(moment($(this).html()).format("ll"));
}
});
// Bind approve/deny buttons.
$('#members_table .approveuser')
.click(function () {
DoApproval($(this).data("uid"), "approve");
});
$('#members_table .denyuser')
.click(function () {
DoApproval($(this).data("uid"), "deny");
});
// Bind edit privs selection
$('#members_table .editprivs')
.on('focusin', function() {
......@@ -394,28 +385,6 @@ function (_, sup, moment, mainString,
xmlthing.done(callback);
}
// Approve or Deny.
function DoApproval(uid, action)
{
console.info(uid, action);
var callback = function(json) {
sup.HideWaitWait();
if (json.code) {
sup.SpitOops("oops", json.value);
return;
}
LoadMembersTab();
}
sup.ShowWaitWait("We are approving (or denying) ... patience please");
var xmlthing =
sup.CallServerMethod(null, "approveuser", action,
{"user_uid" : uid,
"pid" : window.TARGET_PROJECT});
xmlthing.done(callback);
}
// Edit privs
function DoEditPrivs(uid, priv)
{
......@@ -424,11 +393,13 @@ function (_, sup, moment, mainString,
var callback = function(json) {
sup.HideWaitWait();
// Always reload.
LoadMembersTab();
if (json.code) {
sup.SpitOops("oops", json.value);
return;
}
LoadMembersTab();
}
sup.ShowWaitWait("We are modifying privs ... patience please");
var xmlthing =
......@@ -459,12 +430,13 @@ function (_, sup, moment, mainString,
var callback = function(json) {
sup.HideWaitWait();
// Always reload.
LoadMembersTab();
if (json.code) {
sup.SpitOops("oops", json.value);
LoadMembersTab();
return;
}
LoadMembersTab();
}
sup.ShowWaitWait("We are removing users from this project ... " +
"patience please");
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment