initial commit
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
class Autorisatienivos extends MY_Controller{
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array( "shared/Orgusers_model",
|
||||
"shared/Autorisaties_model",
|
||||
"shared/Autorisatienivos_model",
|
||||
"shared/Organisaties_model");
|
||||
$this->load->model($models);
|
||||
$this->load->helper('string');
|
||||
if ( ! $this->check_online_status() ) {
|
||||
echo json_encode( array('offline' => TRUE) );
|
||||
die;
|
||||
};// if
|
||||
}
|
||||
|
||||
public function getautorisaties(){
|
||||
$userid = $this->userid;
|
||||
$orgid = $this->globorgid;
|
||||
if (! $this->super || $this->userrole == 2){
|
||||
$where= array("user_id"=> $userid, "organisatie_id"=>$orgid);
|
||||
$orguserid = $this->Orgusers_model->get_fieldvalue($where, 'id');
|
||||
$where=array("orguser_id" => $orguserid);
|
||||
$userautid = $this->Autorisaties_model->get_fieldvalue($where,'nivo_id');
|
||||
$where=array("id"=>$userautid);
|
||||
$userhierarchie = $this->Autorisatienivos_model->get_fieldvalue($where, "hierarchie");
|
||||
}
|
||||
else {
|
||||
$userhierarchie = 1000;
|
||||
}
|
||||
$autnivos = $this->Autorisatienivos_model->getnivos($userhierarchie);
|
||||
echo json_encode($autnivos);
|
||||
}
|
||||
public function getautorisatie(){
|
||||
$autonivo = $this->Autorisatienivos_model->getusernivo($this->userid);
|
||||
echo json_encode($autonivo);
|
||||
}
|
||||
public function getwriteautorisatie(){
|
||||
// write autorisatie wordt alleen gegeven als
|
||||
// org is eigen organisatie en rechten = management
|
||||
$orgid = $this->uri->segment(4);
|
||||
if (!$orgid) {$orgid = $this->globorgid;};
|
||||
|
||||
$writeOK = false;
|
||||
if ($this->Autorisaties_model->check_autorisatie($this->userrole, 343 ) >0){
|
||||
$writeOK = true;};
|
||||
// check of user lid is van orgid
|
||||
$userorg = $this->Orgusers_model->get_records_where(array('user_id' => $this->userid, 'organisatie_id' => $orgid),true);
|
||||
if (!$userorg) {$writeOK = false ;};
|
||||
// $userorg = $this->Organisaties_model->getuserorg($this->userid);
|
||||
// if ($userorg->id != $orgid) {$writeOK = false;}
|
||||
// super en helpdesk altijd schrijfrecht
|
||||
if ($this->Autorisaties_model->check_autorisatie($this->userrole, 3) == 1){
|
||||
$writeOK = true;
|
||||
|
||||
}
|
||||
echo json_encode($writeOK);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user