Skip to content

Commit 886a3b8

Browse files
committed
Fixed a problem that a site is assigned to the wrong client when it is created by a reseller.
1 parent 5b63359 commit 886a3b8

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

interface/web/sites/ftp_user_edit.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ function onAfterUpdate() {
184184
function getClientName() {
185185
global $app, $conf;
186186

187-
if($_SESSION["s"]["user"]["typ"] != 'admin') {
187+
if($_SESSION["s"]["user"]["typ"] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])) {
188188
// Get the group-id of the user
189189
$client_group_id = $_SESSION["s"]["user"]["default_group"];
190190
} else {

interface/web/sites/shell_user_edit.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ function onAfterUpdate() {
198198
function getClientName() {
199199
global $app, $conf;
200200

201-
if($_SESSION["s"]["user"]["typ"] != 'admin') {
201+
if($_SESSION["s"]["user"]["typ"] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])) {
202202
// Get the group-id of the user
203203
$client_group_id = $_SESSION["s"]["user"]["default_group"];
204204
} else {

interface/web/sites/tools.inc.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ function replacePrefix($name, $dataRecord){
5353
function getClientName($dataRecord) {
5454
global $app, $conf;
5555

56-
if($_SESSION["s"]["user"]["typ"] != 'admin') {
56+
if($_SESSION["s"]["user"]["typ"] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])) {
5757
// Get the group-id of the user
5858
$client_group_id = $_SESSION["s"]["user"]["default_group"];
5959
} else {
@@ -79,7 +79,7 @@ function getClientName($dataRecord) {
7979
function getClientID($dataRecord) {
8080
global $app, $conf;
8181

82-
if($_SESSION["s"]["user"]["typ"] != 'admin') {
82+
if($_SESSION["s"]["user"]["typ"] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])) {
8383
// Get the group-id of the user
8484
$client_group_id = $_SESSION["s"]["user"]["default_group"];
8585
} else {

interface/web/sites/web_domain_edit.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ function onAfterInsert() {
254254
$document_root = str_replace("[website_id]",$this->id,$web_config["website_path"]);
255255

256256
// get the ID of the client
257-
if($_SESSION["s"]["user"]["typ"] != 'admin') {
257+
if($_SESSION["s"]["user"]["typ"] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])) {
258258
$client_group_id = $_SESSION["s"]["user"]["default_group"];
259259
$client = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE sys_group.groupid = $client_group_id");
260260
$client_id = intval($client["client_id"]);
@@ -342,7 +342,7 @@ function onAfterUpdate() {
342342
$client_id = intval($client["client_id"]);
343343
}
344344

345-
if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($this->dataRecord["client_group_id"]) && $this->dataRecord["client_group_id"] != $this->oldDataRecord["client_group_id"]) {
345+
if(($_SESSION["s"]["user"]["typ"] == 'admin' || $app->auth->has_clients($_SESSION['s']['user']['userid'])) && isset($this->dataRecord["client_group_id"]) && $this->dataRecord["client_group_id"] != $this->oldDataRecord["client_group_id"]) {
346346
// Set the values for document_root, system_user and system_group
347347
$system_user = 'web'.$this->id;
348348
$system_group = 'client'.$client_id;

0 commit comments

Comments
 (0)