Initial commit
This commit is contained in:
30
application/WorkerPermission/WorkerPermission.php
Normal file
30
application/WorkerPermission/WorkerPermission.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
class WorkerPermission extends mfBaseModel {
|
||||
public $isAdmin = false;
|
||||
public $isTicketadmin = false;
|
||||
|
||||
public function loadByUserId($userid) {
|
||||
$res = $this->db->select($this->table,"*","worker_id=$userid");
|
||||
if($this->db->num_rows($res)) {
|
||||
$data = $this->db->fetch_object($res);
|
||||
$this->load($data);
|
||||
} else {
|
||||
$this->worker_id = $userid;
|
||||
$this->admin = 'false';
|
||||
$this->save();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected function afterLoad() {
|
||||
if($this->admin == 'true') {
|
||||
$this->isAdmin = true;
|
||||
}
|
||||
if($this->ticketadmin == 'true') {
|
||||
$this->isTicketadmin = true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user