From cb9289f09c8e29ba67c6e6b3ff1a9a57097d6fbe Mon Sep 17 00:00:00 2001 From: Quitta Date: Fri, 19 Jul 2013 00:12:29 +0200 Subject: [PATCH] made it possible or mod's to watch the support group lists, though not to edit them + fixed userlist --- .../server/ryzom_ams/www/html/inc/sgroup_list.php | 7 +++++-- .../server/ryzom_ams/www/html/inc/show_sgroup.php | 10 +++++++--- .../tools/server/ryzom_ams/www/html/inc/userlist.php | 2 +- .../ryzom_ams/www/html/templates/sgroup_list.tpl | 7 ++++--- .../ryzom_ams/www/html/templates/show_sgroup.tpl | 8 +++++--- .../server/ryzom_ams/www/html/templates/userlist.tpl | 3 ++- 6 files changed, 24 insertions(+), 13 deletions(-) diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/inc/sgroup_list.php b/code/ryzom/tools/server/ryzom_ams/www/html/inc/sgroup_list.php index 01c2b16f2..3d380c2d2 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/inc/sgroup_list.php +++ b/code/ryzom/tools/server/ryzom_ams/www/html/inc/sgroup_list.php @@ -3,14 +3,17 @@ function sgroup_list(){ //if logged in if(WebUsers::isLoggedIn()){ - if(Ticket_User::isAdmin($_SESSION['ticket_user'])){ + if(Ticket_User::isMod($_SESSION['ticket_user'])){ - if(isset($_GET['delete'])){ + if(isset($_GET['delete']) && Ticket_User::isAdmin($_SESSION['ticket_user'])){ $delete_id = filter_var($_GET['delete'], FILTER_SANITIZE_NUMBER_INT); $result['delete'] = Support_Group::deleteSupportGroup( $delete_id); header("Location: index.php?page=sgroup_list"); exit; } + if(Ticket_User::isAdmin($_SESSION['ticket_user'])){ + $result['isAdmin'] = "TRUE"; + } $result['grouplist'] = Gui_Elements::make_table(Support_Group::getGroups(), Array("getSGroupId","getName","getTag"), Array("sGroupId","name","tag")); return $result; }else{ diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_sgroup.php b/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_sgroup.php index c31c4d282..e68e8d96d 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_sgroup.php +++ b/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_sgroup.php @@ -3,19 +3,23 @@ function show_sgroup(){ //if logged in if(WebUsers::isLoggedIn()){ - if(Ticket_User::isAdmin($_SESSION['ticket_user'])){ + if(Ticket_User::isMod($_SESSION['ticket_user'])){ if( isset($_GET['id'])){ - //['target_id'] holds the id of the group! $result['target_id'] = filter_var($_GET['id'], FILTER_SANITIZE_NUMBER_INT); - if(isset($_GET['delete'])){ + if(isset($_GET['delete']) && Ticket_User::isAdmin($_SESSION['ticket_user'])){ $delete_id = filter_var($_GET['delete'], FILTER_SANITIZE_NUMBER_INT); $result['delete'] = Support_Group::deleteUserOfSupportGroup( $delete_id, $result['target_id'] ); header("Location: index.php?page=show_sgroup&id=" . $result['target_id']); exit; } + + if(Ticket_User::isAdmin($_SESSION['ticket_user'])){ + $result['isAdmin'] = "TRUE"; + } + $group = Support_Group::getGroup($result['target_id']); $result['groupsname'] = $group->getName(); diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/inc/userlist.php b/code/ryzom/tools/server/ryzom_ams/www/html/inc/userlist.php index 347be52dc..032a61835 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/inc/userlist.php +++ b/code/ryzom/tools/server/ryzom_ams/www/html/inc/userlist.php @@ -8,7 +8,7 @@ function userlist(){ while($row = $users->fetch(PDO::FETCH_ASSOC)){ $pageResult['userlist'][$i]['id'] = $row['UId']; $pageResult['userlist'][$i]['username'] = $row['Login']; - $pageResult['userlist'][$i]['permission'] = $row['Permission']; + $pageResult['userlist'][$i]['permission'] = Ticket_User::constr_ExternId($row['UId'])->getPermission(); $pageResult['userlist'][$i]['email'] = $row['Email']; $i++; } diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/templates/sgroup_list.tpl b/code/ryzom/tools/server/ryzom_ams/www/html/templates/sgroup_list.tpl index 48ba87bfc..57ab6e01f 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/templates/sgroup_list.tpl +++ b/code/ryzom/tools/server/ryzom_ams/www/html/templates/sgroup_list.tpl @@ -19,7 +19,7 @@ ID Name Tag - Action + {if isset($isAdmin) && $isAdmin eq 'TRUE'}Action{/if} @@ -28,7 +28,7 @@ {$group.sGroupId} {$group.name} {$group.tag} - Delete + {if isset($isAdmin) && $isAdmin eq 'TRUE'} Delete{/if} {/foreach} @@ -37,7 +37,7 @@ - + {if isset($isAdmin) && $isAdmin eq 'TRUE'}

Add

@@ -102,6 +102,7 @@
+ {/if} {/block} diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/templates/show_sgroup.tpl b/code/ryzom/tools/server/ryzom_ams/www/html/templates/show_sgroup.tpl index b8ef0245a..6ed551bfc 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/templates/show_sgroup.tpl +++ b/code/ryzom/tools/server/ryzom_ams/www/html/templates/show_sgroup.tpl @@ -16,7 +16,7 @@ ID Name - Action + {if isset($isAdmin) && $isAdmin eq 'TRUE'}Action{/if} @@ -25,7 +25,7 @@ {$user.tUserId} {$user.name} - Delete + {if isset($isAdmin) && $isAdmin eq 'TRUE'} Delete{/if} {/foreach} @@ -34,7 +34,8 @@ - + + {if isset($isAdmin) && $isAdmin eq 'TRUE'}

Add User

@@ -91,6 +92,7 @@
+ {/if} {/block} diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/templates/userlist.tpl b/code/ryzom/tools/server/ryzom_ams/www/html/templates/userlist.tpl index d09c46abe..069f69316 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/templates/userlist.tpl +++ b/code/ryzom/tools/server/ryzom_ams/www/html/templates/userlist.tpl @@ -27,7 +27,8 @@ {$element.username} {$element.email} {if $element.permission eq 1}User{/if} - {if $element.permission eq 2}Admin{/if} + {if $element.permission eq 2}Moderator{/if} + {if $element.permission eq 3}Admin{/if} Show User Edit User