svn: /web/doc-editor/trunk/php/ AccountManager.php

[email protected] (Yannick Torres)
Newsgroups php.doc.web
Message-ID <[email protected]>
yannick                                  Thu, 30 Dec 2010 22:08:19 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=306882

Log:
Add a new method to simplify the check if the user is a global admin or a language admin

Changed paths:
    U   web/doc-editor/trunk/php/AccountManager.php

Modified: web/doc-editor/trunk/php/AccountManager.php
===================================================================
--- web/doc-editor/trunk/php/AccountManager.php	2010-12-30 21:37:13 UTC (rev 306881)
+++ web/doc-editor/trunk/php/AccountManager.php	2010-12-30 22:08:19 UTC (rev 306882)
@@ -358,6 +358,19 @@
         return ( in_array($this->vcsLogin, $admin) ) ? true : false;
     }

+    public function isAdmin($lang=false)
+    {
+        // If lang is true, this method must return true if current user is either a global admin, or a lang admin
+        if( $lang ) {
+            return ( $this->isGlobalAdmin() || $this->isLangAdmin() ) ? true : false;
+        } else {
+            // If lang is false, this method must return true if current user is ONLY a global admin
+            return ( $this->isGlobalAdmin() ) ? true : false;
+        }
+
+        return false;
+    }
+
     public function updateEmail()
     {
         $db = DBConnection::getInstance();
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.