UserGroup::isMember() is no longer static
authorTim Düsterhus <timwolla@arcor.de>
Tue, 7 Aug 2012 15:16:16 +0000 (17:16 +0200)
committerTim Düsterhus <timwolla@arcor.de>
Tue, 7 Aug 2012 15:16:16 +0000 (17:16 +0200)
wcfsetup/install/files/lib/data/user/group/UserGroup.class.php

index 82cbca74d328d5633685e60919cf8b99aeda9267..4c6ecc298cefe080066fa90871ed024fbce0c6be 100644 (file)
@@ -130,13 +130,12 @@ class UserGroup extends DatabaseObject {
        }
        
        /**
-        * Returns true, if the active user is member of the given group.
+        * Returns true, if the active user is member of the group.
         * 
-        * @param       integer         $groupID
-        * @return      boolean             
+        * @return      boolean
         */
-       public static function isMember($groupID) {
-               if (in_array($groupID, WCF::getUser()->getGroupIDs())) return true;
+       public function isMember() {
+               if (in_array($this->groupID, WCF::getUser()->getGroupIDs())) return true;
                return false;
        }
        
@@ -224,6 +223,7 @@ class UserGroup extends DatabaseObject {
         * @return      string
         */
        public function getName() {
+               // TODO: Is the output correct when I18n is not used?
                return WCF::getLanguage()->get('wcf.acp.group.group'.$this->groupID);
        }
        
@@ -237,10 +237,10 @@ class UserGroup extends DatabaseObject {
                if (!WCF::getSession()->getPermission('admin.user.canDeleteGroup')) return false;
                
                // cannot delete own groups
-               if (UserGroup::isMember($this->groupID)) return false;
+               if ($this->isMember()) return false;
                
                // user cannot delete this group
-               if (!UserGroup::isAccessibleGroup(array($this->groupID))) return false;
+               if (!$this->isAccessible()) return false;
                
                // cannot delete static groups
                if ($this->groupType == UserGroup::EVERYONE || $this->groupType == UserGroup::GUESTS || $this->groupType == UserGroup::USERS) return false;
@@ -258,7 +258,7 @@ class UserGroup extends DatabaseObject {
                if (!WCF::getSession()->getPermission('admin.user.canEditGroup')) return false;
                
                // user cannot edit this group
-               if (!UserGroup::isAccessibleGroup(array($this->groupID))) return false;
+               if (!$this->isAccessible()) return false;
                
                return true;
        }