Comparison for `never` values for boolean options
authorAlexander Ebert <ebert@woltlab.com>
Fri, 8 Jun 2018 12:00:03 +0000 (14:00 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Mon, 16 Jul 2018 11:58:07 +0000 (13:58 +0200)
wcfsetup/install/files/lib/system/option/user/group/BooleanUserGroupOptionType.class.php

index cf006f816cccf661a198308f5d296ee73fe37f4b..cb8127308d92159d5c36c924f3eb48abb66e121e 100644 (file)
@@ -57,4 +57,19 @@ class BooleanUserGroupOptionType extends BooleanOptionType implements IUserGroup
                
                return $groupValue;
        }
+       
+       /**
+        * @inheritDoc
+        */
+       public function compare($value1, $value2) {
+               if ($value1 == $value2) {
+                       return 0;
+               }
+               else if ($value1 == -1) {
+                       // this is the `never` permission
+                       return -1;
+               }
+               
+               return $value1 ? 1 : -1;
+       }
 }