@@ -41,14 +41,14 @@ class Room extends \chat\data\CHATDatabaseObject implements \wcf\system\request\
4141 public function __toString () {
4242 return $ this ->getTitle ();
4343 }
44-
44+
4545 /**
46- * Returns whether the user is allowed to enter the room.
46+ * Returns whther the user is allowed to always enter the room.
4747 *
4848 * @param \wcf\data\user\User $user
4949 * @return boolean
5050 */
51- public function canEnter (\wcf \data \user \User $ user = null ) {
51+ public function canAlwaysEnter (\wcf \data \user \User $ user = null ) {
5252 if ($ user === null ) $ user = WCF ::getUser ();
5353 if (!$ user ->userID ) return false ;
5454 $ user = new \wcf \data \user \UserProfile ($ user );
@@ -59,7 +59,23 @@ public function canEnter(\wcf\data\user\User $user = null) {
5959 $ ph = new \chat \system \permission \PermissionHandler ($ user ->getDecoratedObject ());
6060 if ($ ph ->getPermission ($ this , 'mod.canAlwaysEnter ' )) return true ;
6161 if ($ ph ->getPermission ($ this , 'mod.canBan ' )) return true ;
62+
63+ return false ;
64+ }
65+
66+ /**
67+ * Returns whether the user is allowed to enter the room.
68+ *
69+ * @param \wcf\data\user\User $user
70+ * @return boolean
71+ */
72+ public function canEnter (\wcf \data \user \User $ user = null ) {
73+ if ($ user === null ) $ user = WCF ::getUser ();
74+ if (!$ user ->userID ) return false ;
75+ if ($ this ->canAlwaysEnter ($ user )) return true ;
76+ $ user = new \wcf \data \user \UserProfile ($ user );
6277
78+ $ ph = new \chat \system \permission \PermissionHandler ($ user ->getDecoratedObject ());
6379 if (!$ ph ->getPermission ($ this , 'user.canEnter ' )) return false ;
6480
6581 $ suspensions = Suspension::getSuspensionsForUser ($ user ->getDecoratedObject ());
0 commit comments