diff --git a/Models/AccountPermission.php b/Models/AccountPermission.php new file mode 100644 index 0000000..7533f79 --- /dev/null +++ b/Models/AccountPermission.php @@ -0,0 +1,36 @@ + ['name' => 'account_permission_id', 'type' => 'int', 'internal' => 'id'], + 'account_permission_account' => ['name' => 'account_permission_account', 'type' => 'int', 'internal' => 'account'], + 'account_permission_unit' => ['name' => 'account_permission_unit', 'type' => 'int', 'internal' => 'unit'], + 'account_permission_app' => ['name' => 'account_permission_app', 'type' => 'int', 'internal' => 'app'], + 'account_permission_module' => ['name' => 'account_permission_module', 'type' => 'int', 'internal' => 'module'], + 'account_permission_from' => ['name' => 'account_permission_from', 'type' => 'int', 'internal' => 'from'], + 'account_permission_type' => ['name' => 'account_permission_type', 'type' => 'int', 'internal' => 'type'], + 'account_permission_element' => ['name' => 'account_permission_element', 'type' => 'int', 'internal' => 'element'], + 'account_permission_component' => ['name' => 'account_permission_component', 'type' => 'int', 'internal' => 'component'], + 'account_permission_permission' => ['name' => 'account_permission_permission', 'type' => 'int', 'internal' => 'permission'], + ]; + + /** + * Primary table. + * + * @var string + * @since 1.0.0 + */ + protected static $table = 'account_permission'; + + /** + * Primary field name. + * + * @var string + * @since 1.0.0 + */ + protected static $primaryField = 'account_permission_id'; + + /** + * Get object. + * + * @param mixed $primaryKey Key + * @param int $relations Load relations + * @param mixed $fill Object to fill + * + * @return Group + * + * @since 1.0.0 + */ + public static function get($primaryKey, int $relations = RelationType::ALL, $fill = null) + { + return parent::get($primaryKey, $relations, $fill); + } +} diff --git a/Models/GroupPermission.php b/Models/GroupPermission.php new file mode 100644 index 0000000..20cb8ed --- /dev/null +++ b/Models/GroupPermission.php @@ -0,0 +1,36 @@ + ['name' => 'group_permission_id', 'type' => 'int', 'internal' => 'id'], + 'group_permission_group' => ['name' => 'group_permission_group', 'type' => 'int', 'internal' => 'group'], + 'group_permission_unit' => ['name' => 'group_permission_unit', 'type' => 'int', 'internal' => 'unit'], + 'group_permission_app' => ['name' => 'group_permission_app', 'type' => 'int', 'internal' => 'app'], + 'group_permission_module' => ['name' => 'group_permission_module', 'type' => 'int', 'internal' => 'module'], + 'group_permission_from' => ['name' => 'group_permission_from', 'type' => 'int', 'internal' => 'from'], + 'group_permission_type' => ['name' => 'group_permission_type', 'type' => 'int', 'internal' => 'type'], + 'group_permission_element' => ['name' => 'group_permission_element', 'type' => 'int', 'internal' => 'element'], + 'group_permission_component' => ['name' => 'group_permission_component', 'type' => 'int', 'internal' => 'component'], + 'group_permission_permission' => ['name' => 'group_permission_permission', 'type' => 'int', 'internal' => 'permission'], + ]; + + /** + * Primary table. + * + * @var string + * @since 1.0.0 + */ + protected static $table = 'group_permission'; + + /** + * Primary field name. + * + * @var string + * @since 1.0.0 + */ + protected static $primaryField = 'group_permission_id'; + + /** + * Get object. + * + * @param mixed $primaryKey Key + * @param int $relations Load relations + * @param mixed $fill Object to fill + * + * @return Group + * + * @since 1.0.0 + */ + public static function get($primaryKey, int $relations = RelationType::ALL, $fill = null) + { + return parent::get($primaryKey, $relations, $fill); + } +} diff --git a/Models/ModuleMapper.php b/Models/ModuleMapper.php index f814a44..67840af 100644 --- a/Models/ModuleMapper.php +++ b/Models/ModuleMapper.php @@ -47,14 +47,6 @@ class ModuleMapper extends DataMapperAbstract */ protected static $primaryField = 'module_id'; - /** - * Created at column - * - * @var string - * @since 1.0.0 - */ - protected static $createdAt = 'group_created'; - /** * Get object. * diff --git a/Models/PermissionAbstract.php b/Models/PermissionAbstract.php new file mode 100644 index 0000000..de3ec54 --- /dev/null +++ b/Models/PermissionAbstract.php @@ -0,0 +1,136 @@ +unit; + } + + public function getApp() + { + return $this->app; + } + + public function getModule() + { + return $this->module; + } + + public function getFrom() + { + return $this->from; + } + + public function getType() + { + return $this->type; + } + + public function getElement() + { + return $this->element; + } + + public function getComponent() + { + return $this->component; + } + + public function getPermission() : int + { + return $this->permission; + } + + public function setUnit(int $unit = null) /* : void */ + { + $this->unit = $unit; + } + + public function setApp(int $app = null) /* : void */ + { + $this->app = $app; + } + + public function setModule(int $module = null) /* : void */ + { + $this->module = $module; + } + + public function setFrom(int $from = null) /* : void */ + { + $this->from = $from; + } + + public function setType(int $type = null) /* : void */ + { + $this->type = $type; + } + + public function setElement(int $element = null) /* : void */ + { + $this->element = $element; + } + + public function setComponent(int $component = null) /* : void */ + { + $this->component = $component; + } + + public function setPermission(int $permission = 0) /* : void */ + { + if($permission === 0) { + $this->permission = 0; + } else { + $this->permission |= $permission; + } + } +} diff --git a/Models/PermissionType.php b/Models/PermissionType.php new file mode 100644 index 0000000..9376342 --- /dev/null +++ b/Models/PermissionType.php @@ -0,0 +1,41 @@ + + * @author Dennis Eichhorn + * @copyright Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +declare(strict_types=1); + +namespace Modules\Admin\Models; + +use phpOMS\Datatypes\Enum; + +/** + * Permission type enum. + * + * @category Framework + * @package phpOMS\DataStorage\Database + * @author OMS Development Team + * @author Dennis Eichhorn + * @license OMS License 1.0 + * @link http://orange-management.com + * @since 1.0.0 + */ +abstract class PermissionType extends Enum +{ + /* public */ const NONE = 0; + /* public */ const READ = 1; + /* public */ const CREATE = 2; + /* public */ const MODIFY = 4; + /* public */ const DELETE = 8; + /* public */ const PERMISSION = 16; +}