mirror of
https://github.com/Karaka-Management/oms-Admin.git
synced 2026-02-14 19:48:41 +00:00
Create permission obj+mapper
This commit is contained in:
parent
e88d20d081
commit
dcc6a96751
36
Models/AccountPermission.php
Normal file
36
Models/AccountPermission.php
Normal file
|
|
@ -0,0 +1,36 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Orange Management
|
||||||
|
*
|
||||||
|
* PHP Version 7.1
|
||||||
|
*
|
||||||
|
* @category TBD
|
||||||
|
* @package TBD
|
||||||
|
* @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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* InfoManager class.
|
||||||
|
*
|
||||||
|
* Handling the info files for modules
|
||||||
|
*
|
||||||
|
* @category Framework
|
||||||
|
* @package phpOMS\Module
|
||||||
|
* @license OMS License 1.0
|
||||||
|
* @link http://orange-management.com
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
class AccountPermission extends PermissionAbstract
|
||||||
|
{
|
||||||
|
private $account = 0;
|
||||||
|
|
||||||
|
public function getAccount() : int
|
||||||
|
{
|
||||||
|
return $account;
|
||||||
|
}
|
||||||
|
}
|
||||||
73
Models/AccountPermissionMapper.php
Normal file
73
Models/AccountPermissionMapper.php
Normal file
|
|
@ -0,0 +1,73 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Orange Management
|
||||||
|
*
|
||||||
|
* PHP Version 7.1
|
||||||
|
*
|
||||||
|
* @category TBD
|
||||||
|
* @package TBD
|
||||||
|
* @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\DataStorage\Database\DataMapperAbstract;
|
||||||
|
use phpOMS\DataStorage\Database\RelationType;
|
||||||
|
|
||||||
|
class AccountPermissionMapper extends DataMapperAbstract
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Columns.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
protected static $columns = [
|
||||||
|
'account_permission_id' => ['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);
|
||||||
|
}
|
||||||
|
}
|
||||||
36
Models/GroupPermission.php
Normal file
36
Models/GroupPermission.php
Normal file
|
|
@ -0,0 +1,36 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Orange Management
|
||||||
|
*
|
||||||
|
* PHP Version 7.1
|
||||||
|
*
|
||||||
|
* @category TBD
|
||||||
|
* @package TBD
|
||||||
|
* @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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* InfoManager class.
|
||||||
|
*
|
||||||
|
* Handling the info files for modules
|
||||||
|
*
|
||||||
|
* @category Framework
|
||||||
|
* @package phpOMS\Module
|
||||||
|
* @license OMS License 1.0
|
||||||
|
* @link http://orange-management.com
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
class GroupPermission extends PermissionAbstract
|
||||||
|
{
|
||||||
|
private $group = 0;
|
||||||
|
|
||||||
|
public function getGroup() : int
|
||||||
|
{
|
||||||
|
return $group;
|
||||||
|
}
|
||||||
|
}
|
||||||
73
Models/GroupPermissionMapper.php
Normal file
73
Models/GroupPermissionMapper.php
Normal file
|
|
@ -0,0 +1,73 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Orange Management
|
||||||
|
*
|
||||||
|
* PHP Version 7.1
|
||||||
|
*
|
||||||
|
* @category TBD
|
||||||
|
* @package TBD
|
||||||
|
* @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\DataStorage\Database\DataMapperAbstract;
|
||||||
|
use phpOMS\DataStorage\Database\RelationType;
|
||||||
|
|
||||||
|
class GroupPermissionMapper extends DataMapperAbstract
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Columns.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
protected static $columns = [
|
||||||
|
'group_permission_id' => ['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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -47,14 +47,6 @@ class ModuleMapper extends DataMapperAbstract
|
||||||
*/
|
*/
|
||||||
protected static $primaryField = 'module_id';
|
protected static $primaryField = 'module_id';
|
||||||
|
|
||||||
/**
|
|
||||||
* Created at column
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
protected static $createdAt = 'group_created';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get object.
|
* Get object.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
136
Models/PermissionAbstract.php
Normal file
136
Models/PermissionAbstract.php
Normal file
|
|
@ -0,0 +1,136 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Orange Management
|
||||||
|
*
|
||||||
|
* PHP Version 7.1
|
||||||
|
*
|
||||||
|
* @category TBD
|
||||||
|
* @package TBD
|
||||||
|
* @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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* InfoManager class.
|
||||||
|
*
|
||||||
|
* Handling the info files for modules
|
||||||
|
*
|
||||||
|
* @category Framework
|
||||||
|
* @package phpOMS\Module
|
||||||
|
* @license OMS License 1.0
|
||||||
|
* @link http://orange-management.com
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
abstract class PermissionAbstract
|
||||||
|
{
|
||||||
|
private $id = 0;
|
||||||
|
|
||||||
|
private $unit = null;
|
||||||
|
|
||||||
|
private $app = null;
|
||||||
|
|
||||||
|
private $module = null;
|
||||||
|
|
||||||
|
private $from = 0;
|
||||||
|
|
||||||
|
private $type = null;
|
||||||
|
|
||||||
|
private $element = null;
|
||||||
|
|
||||||
|
private $component = null;
|
||||||
|
|
||||||
|
private $permission = 0;
|
||||||
|
|
||||||
|
public function getId()
|
||||||
|
{
|
||||||
|
return $id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getUnit()
|
||||||
|
{
|
||||||
|
return $this->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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
41
Models/PermissionType.php
Normal file
41
Models/PermissionType.php
Normal file
|
|
@ -0,0 +1,41 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Orange Management
|
||||||
|
*
|
||||||
|
* PHP Version 7.1
|
||||||
|
*
|
||||||
|
* @category TBD
|
||||||
|
* @package TBD
|
||||||
|
* @author OMS Development Team <dev@oms.com>
|
||||||
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
|
* @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 <dev@oms.com>
|
||||||
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
|
* @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;
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user