"Bertrand", * "http://www.tao.lu/Ontologies/generis.rdf#userLastName" => "Chevrier", * "http://www.tao.lu/Ontologies/generis.rdf#userMail" => "bertrand@taotesting.com", * "http://www.tao.lu/Ontologies/generis.rdf#userDefLg" => "http://www.tao.lu/Ontologies/TAO.rdf#Langfr-FR", * "http://www.tao.lu/Ontologies/generis.rdf#userUILg" => "http://www.tao.lu/Ontologies/TAO.rdf#Langfr-FR", * "http://www.tao.lu/Ontologies/generis.rdf#login" => "berty", * "http://www.w3.org/2000/01/rdf-schema#label" => "bertounet", * "http://www.tao.lu/Ontologies/generis.rdf#userRoles"=> [ * 'http://www.tao.lu/Ontologies/TAOProctor.rdf#ProctorRole', * 'http://www.tao.lu/Ontologies/TAO.rdf#SysAdminRole' * ], * 'password1' => 'ctl789@CTL789@', * 'password2' => 'ctl789@CTL789@', * ] */ class tao_actions_RestUser extends tao_actions_RestResource { /** * Return the form object to manage user edition or creation * * @param $instance * @return tao_actions_form_RestUserForm */ protected function getForm($instance) { return $this->propagate(new \tao_actions_form_RestUserForm($instance)); } /** * Return the resource parameter * * @return core_kernel_classes_Resource * @InvalidArgumentException If resource does not belong to GenerisRdf::CLASS_GENERIS_USER */ protected function getResourceParameter() { $resource = parent::getResourceParameter(); if ($resource->isInstanceOf($this->getClass(GenerisRdf::CLASS_GENERIS_USER))) { return $resource; } throw new InvalidArgumentException('Only user resource are allowed.'); } /** * Return the class parameter * * @return core_kernel_classes_Resource * @InvalidArgumentException If class is not an instance GenerisRdf::CLASS_GENERIS_USER */ protected function getClassParameter() { $class = parent::getClassParameter(); $rootUserClass = $this->getClass(GenerisRdf::CLASS_GENERIS_USER); if ($class->getUri() == $rootUserClass->getUri()) { return $class; } /** @var core_kernel_classes_Class $instance */ foreach ($rootUserClass->getSubClasses(true) as $instance) { if ($instance->getUri() == $class->getUri()) { return $class; } } throw new InvalidArgumentException('Only user classes are allowed as classUri.'); } }