public function getRollenVoorApplicatie(KVDutil_Auth_Gebruiker $gebruiker, $applicatie) { $stmt = $this->db->prepare($this->getRollenForGebruikerApplicatieIdStatement()); $stmt->bindParam(1, $gebruiker->getId()); $stmt->bindParam(2, $applicatie->getId()); $stmt->execute(); $rollen = array(); while ($rol = $stmt->fetch(PDO::FETCH_OBJ)) { //ID is hier gelijk aan rolnaam. //Meer informatie hieromtrent in constructor van KVDutil_Auth_Rol $rollen[] = new KVDutil_Auth_Rol($rol->{$this->parameters['rol_naam']}, $rol->{$this->parameters['rol_naam']}, $rol->{$this->parameters['rol_beschrijving']}); } //De array met objecten wordt in een KVDdom_DomainObjectCollection geplaatst. return new KVDutil_Auth_RolCollectie($rollen); }
/** * Haal de rollen van de huidige gebruiker op voor een opgegeven applicatie naam * In onze LDAP server vertegenwoordigd het veld description de volledige naam van de applicatie * * @param KVDutil_Auth_Gebruiker $gebruiker * @param string $applicatieNaam * structuur: 'ou='.$applicatieNaam.',ou=productie,ou=groups,dc=vioe,dc=be' * @return KVDutil_AuthRolCollectie $rollen */ public function getRollenVoorApplicatieNaam(KVDutil_Auth_Gebruiker $gebruiker, $applicatieNaam) { $filter = Net_LDAP2_Filter::create($this->parameters['gebruiker_bij_rol'], 'contains', $gebruiker->getId()); $options = array('scope' => 'sub', 'attributes' => array($this->parameters['rol_naam'], $this->parameters['rol_beschrijving'])); //Voer zoekactie uit op boven meegegeven searchbase met de opgegeven options en filters $search = $this->connectie->search($applicatieNaam, $filter, $options); if (Net_LDAP2::isError($search)) { throw new Exception($search->getMessage()); } $results = array(); //objecten worden 1 voor 1 volledig geladen en in een array geplaatst. foreach ($search as $dn => $entry) { $results[$dn] = new KVDutil_Auth_Rol($dn, $entry->getValue($this->parameters['rol_naam'], 'single'), $entry->getValue($this->parameters['rol_beschrijving'], 'single')); } //De array met objecten wordt in een KVDdom_DomainObjectCollection geplaatst. return new KVDutil_Auth_RolCollectie($results); }
/** * Haal de rollen van de huidige gebruiker op voor een opgegeven applicatie naam * * @param KVDutil_Auth_Gebruiker $gebruiker * @param string $applicatieNaam * structuur: 'ou='.$applicatieNaam.',ou=productie,ou=groups,dc=vioe,dc=be' * @return KVDutil_AuthRolCollectie $rollen */ public function getRollenVoorApplicatieNaam(KVDutil_Auth_Gebruiker $gebruiker, $applicatieNaam) { $results = array(); foreach ($this->connectie[$gebruiker->getId()][$this->parameters['rollen']][$applicatieNaam] as $rol => $roldata) { $results[] = new KVDutil_Auth_Rol($rol, $roldata[$this->parameters['rol_naam']], $roldata[$this->parameters['rol_beschrijving']]); } return new KVDutil_Auth_RolCollectie($results); }