Groups: Integrate Show All and ability to edit assigned Domain. Create, edit, delete non-default groups.

Users: Adjust so assigned Domain doesn't get overwritten if user_all permission exists, but user_domain doesn't.
Destinations: Adjust so assigned Domain doesn't get overwritten if destination_all permission exists, but destination_domain doesn't.
This commit is contained in:
Nate Jones
2015-03-31 21:47:31 +00:00
parent 30bb3e211d
commit 88295a53d7
12 changed files with 548 additions and 233 deletions

View File

@@ -42,14 +42,16 @@ require_once "resources/require.php";
//validate the uuid
if (is_uuid($group_uuid)) {
//get the group from v_groups
$sql = "select group_name from v_groups ";
$sql = "select domain_uuid, group_name from v_groups ";
$sql .= "where group_uuid = '".$group_uuid."' ";
$sql .= "and (domain_uuid = '".$_SESSION['domain_uuid']."' or domain_uuid is null); ";
//echo $sql . "\n";
if (!permission_exists('group_domain')) {
$sql .= "and (domain_uuid = '".$_SESSION['domain_uuid']."' or domain_uuid is null); ";
}
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$domain_uuid = $row["domain_uuid"];
$group_name = $row["group_name"];
}
unset ($prep_statement);
@@ -57,8 +59,6 @@ require_once "resources/require.php";
//delete the group users
$sql = "delete from v_group_users ";
$sql .= "where group_uuid = '".$group_uuid."' ";
$sql .= "and (domain_uuid = '".$_SESSION['domain_uuid']."' or domain_uuid is null); ";
//echo $sql . "\n";
if (!$db->exec($sql)) {
$error = $db->errorInfo();
print_r($error);
@@ -68,8 +68,7 @@ require_once "resources/require.php";
if (strlen($group_name) > 0) {
$sql = "delete from v_group_permissions ";
$sql .= "where group_name = '".$group_name."' ";
$sql .= "and (domain_uuid = '".$_SESSION['domain_uuid']."' or domain_uuid is null); ";
//echo $sql . "\n";
$sql .= "and domain_uuid ".(($domain_uuid != '') ? " = '".$domain_uuid."' " : " is null ");
if (!$db->exec($sql)) {
$error = $db->errorInfo();
print_r($error);
@@ -79,8 +78,7 @@ require_once "resources/require.php";
//delete the group
$sql = "delete from v_groups ";
$sql .= "where group_uuid = '".$group_uuid."' ";
$sql .= "and (domain_uuid = '".$_SESSION['domain_uuid']."' or domain_uuid is null); ";
//echo $sql . "\n";
$sql .= "and domain_uuid ".(($domain_uuid != '') ? " = '".$domain_uuid."' " : " is null ");
if (!$db->exec($sql)) {
$error = $db->errorInfo();
print_r($error);
@@ -88,6 +86,7 @@ require_once "resources/require.php";
}
//redirect the user
$_SESSION["message"] = $text['message-delete'];
header("Location: groups.php");
?>