/** * Configured ACL with files * * @access public * * @param array $params configuration array * * @result void */ public function __construct(array $params = []) { parent::__construct($params); $roles = !empty($params['roles']) ? $params['roles'] : []; $this->roles = !empty($roles['roles']) ? $roles['roles'] : []; $this->perms = !empty($roles['perms']) ? $roles['perms'] : []; $this->rolePermsCompare = !empty($roles['role_perms']) ? $roles['role_perms'] : []; }
/** * Constructor DB acl * * @access public * * @param array $params config array * * @result void */ public function __construct(array $params = []) { parent::__construct($params); $tables = $this->container->db->listTables(); if (empty($tables['acl_role'])) { $this->container->db->createTable('acl_role', ['`id` int(10) unsigned NOT NULL AUTO_INCREMENT', '`name` varchar(255) NOT NULL', 'PRIMARY KEY (`id`)'], 'ENGINE=MyISAM DEFAULT CHARSET=utf8'); } if (empty($tables['acl_perm'])) { $this->container->db->createTable('acl_perm', ['`id` int(10) unsigned NOT NULL AUTO_INCREMENT', '`name` varchar(255) NOT NULL', 'PRIMARY KEY (`id`)'], 'ENGINE=MyISAM DEFAULT CHARSET=utf8'); } if (empty($tables['acl_role_perm'])) { $this->container->db->createTable('acl_role_perm', ['`id` int(10) unsigned NOT NULL AUTO_INCREMENT', '`role` int(11) unsigned DEFAULT NOT NULL', '`perm` int(11) unsigned DEFAULT NOT NULL', 'PRIMARY KEY (`id`)'], 'ENGINE=MyISAM DEFAULT CHARSET=utf8'); } }