From: Matthias Schmidt Date: Thu, 21 May 2015 21:14:09 +0000 (+0200) Subject: Add missing trait files X-Git-Tag: 3.0.0_Beta_1~2358 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=625136ac2e609575c849bfa86723626711b2d54a;p=GitHub%2FWoltLab%2FWCF.git Add missing trait files --- diff --git a/wcfsetup/install/files/lib/data/TDatabaseObjectOptions.class.php b/wcfsetup/install/files/lib/data/TDatabaseObjectOptions.class.php new file mode 100644 index 0000000000..e95d5f5bfc --- /dev/null +++ b/wcfsetup/install/files/lib/data/TDatabaseObjectOptions.class.php @@ -0,0 +1,34 @@ + + * @package com.woltlab.wcf + * @subpackage data + * @category Community Framework + */ +trait TDatabaseObjectOptions { + /** + * Returns true if at least one of the options required by this object is set. + * + * @return boolean + */ + public function validateOptions() { + if ($this->options) { + $options = explode(',', strtoupper($this->options)); + foreach ($options as $option) { + if (defined($option) && constant($option)) { + return true; + } + } + + return false; + } + + return true; + } +} diff --git a/wcfsetup/install/files/lib/data/TDatabaseObjectPermissions.class.php b/wcfsetup/install/files/lib/data/TDatabaseObjectPermissions.class.php new file mode 100644 index 0000000000..2d8e015c01 --- /dev/null +++ b/wcfsetup/install/files/lib/data/TDatabaseObjectPermissions.class.php @@ -0,0 +1,36 @@ + + * @package com.woltlab.wcf + * @subpackage data + * @category Community Framework + */ +trait TDatabaseObjectPermissions { + /** + * Returns true if the active user has at least one permission required + * by this object. + * + * @return boolean + */ + public function validatePermissions() { + if ($this->permissions) { + $permissions = explode(',', $this->permissions); + foreach ($permissions as $permission) { + if (WCF::getSession()->getPermission($permission)) { + return true; + } + } + + return false; + } + + return true; + } +}