load->model($models); } function check_autorisatie($role, $level){ $this->sql = "SELECT (".$role." & ".$level.") AS checker"; $query = $this->db->query($this->sql); $row = $query->row(); return $row->checker; } function check_write(){ if($this->super) return TRUE; if($this->orgid==$this->globorgid && $this->check_autorisatie($this->userrole, WRITER)) return TRUE; return false; } function check_partituur_access($partituurid, $type){ $read = TRUE; $write= TRUE; if(!$this->super){ $partorgid = $this->Partituurs_model->get_record_by_id($partituurid, 'partituur_organisatie_id'); if($this->globorgid!=$partorgid){ $read = FALSE; $write= FALSE; }else{ // aangepast van $this->role naar $this->userrole if(!$this->check_autorisatie(WRITER, $this->userrole)){ $write = FALSE; } } } if($type==1){ return $read; }else{ return $write; } } }