load->model($models); } function check_autorisatie($role, $level){ $this->sql = " SELECT {$role} & {$level} AS level"; $check = $this->get_query_row('level'); return $check; } function get_autorisaties($level){ $autotypes = $this->Autorisatietypes_model->get_records_where(); if(!$autotypes) return FALSE; foreach($autotypes as $autotype){ if($this->check_autorisatie($autotype->autorisatietype_level, $level)){ $autorisaties[] = $autotype->autorisatietype_naam; } } if(!isset($autorisaties)) $autorisaties = FALSE; return $autorisaties; } function check_partituur_access($partituurid, $type){ $read = TRUE; $write= TRUE; if(!$this->admin){ $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(WRITE, $this->userrole)){ $write = FALSE; } } } if($type==1){ return $read; }else{ return $write; } } function get_autorisaties_per_gebruiker($min,$max){ $this->sql = "SELECT id, autorisatietype_level as level, autorisatietype_naam as omschrijving FROM tb_autorisatietypes WHERE autorisatietype_level >= {$min} AND autorisatietype_level <= {$max} "; return $this->get_query_result(); } }