From e7f83761ecdb02e37e88669c1db4a1ae6d8408ac Mon Sep 17 00:00:00 2001 From: Quitta Date: Fri, 19 Jul 2013 03:05:12 +0200 Subject: [PATCH] Promoting a user to mod/admin or mod to admin, or demoting mod to user, admin to mod/user is now possible! --- .../ams_lib/autoload/ticket_user.php | 6 +++ .../www/html/inc/change_permission.php | 39 +++++++++++++++++++ .../ryzom_ams/www/html/inc/show_user.php | 3 ++ .../www/html/templates/show_user.tpl | 14 +++++++ 4 files changed, 62 insertions(+) create mode 100644 code/ryzom/tools/server/ryzom_ams/www/html/inc/change_permission.php diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_user.php b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_user.php index a26f4f5f2..6e3b6c783 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_user.php +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_user.php @@ -51,6 +51,12 @@ class Ticket_User{ } + public static function change_permission($user_id, $perm){ + $user = new Ticket_User(); + $user->load_With_TUserId($user_id); + $user->setPermission($perm); + $user->update(); + } ////////////////////////////////////////////Methods//////////////////////////////////////////////////// public function __construct() { diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/inc/change_permission.php b/code/ryzom/tools/server/ryzom_ams/www/html/inc/change_permission.php new file mode 100644 index 000000000..184b135d1 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams/www/html/inc/change_permission.php @@ -0,0 +1,39 @@ +getPermission(); + if(Ticket_User::isAdmin($_SESSION['ticket_user'])){ + $result['isAdmin'] = "TRUE"; + } $ticketlist = Ticket::getTicketsOf($ticket_user->getTUserId()); $result['ticketlist'] = Gui_Elements::make_table($ticketlist, Array("getTId","getTimestamp","getTitle","getStatus","getStatusText","getStatusText","getCategoryName"), Array("tId","timestamp","title","status","statustext","statusText","category")); diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/templates/show_user.tpl b/code/ryzom/tools/server/ryzom_ams/www/html/templates/show_user.tpl index 1780724d6..91bdc683f 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/templates/show_user.tpl +++ b/code/ryzom/tools/server/ryzom_ams/www/html/templates/show_user.tpl @@ -77,6 +77,20 @@
  • Edit User
  • Send Ticket
  • + {if isset($isAdmin) and $isAdmin eq 'TRUE' and $target_id neq 1} + {if $userPermission eq 1} +
  • Make Moderator
  • +
  • Make Admin
  • + {else if $userPermission eq 2 } +
  • Demote to User
  • +
  • Make Admin
  • + {else if $userPermission eq 3 } +
  • Demote to User
  • +
  • Demote to Moderator
  • + {/if} +
  • + {/if} +