diff --git a/appinfo/info.xml b/appinfo/info.xml
index 21783ee..8b40e68 100644
--- a/appinfo/info.xml
+++ b/appinfo/info.xml
@@ -5,7 +5,7 @@
Agency
App for managing Agency of DA
- 0.0.1
+ 0.0.2
Agency
tools
diff --git a/appinfo/routes.php b/appinfo/routes.php
index 7d387f6..abb37bc 100644
--- a/appinfo/routes.php
+++ b/appinfo/routes.php
@@ -6,5 +6,6 @@ return [
'routes' => [
['name' => 'page#index', 'url' => '/', 'verb' => 'GET'],
['name' => 'agency#getagencyidbyuser', 'url' => '/getagencyidbyuser', 'verb' => 'GET'],
+ ['name' => 'test#filetest', 'url' => '/filetest', 'verb' => 'GET'],
]
];
diff --git a/lib/Agency/AgencyManager.php b/lib/Agency/AgencyManager.php
new file mode 100644
index 0000000..a1d5c67
--- /dev/null
+++ b/lib/Agency/AgencyManager.php
@@ -0,0 +1,24 @@
+appName = $appName;
+ $this->agencyMapper = new AgencyMapper($db);
+ }
+
+ public function createAgencyOnReg(string $agencygid, string $agencydirid, string $standarddirid){
+
+ $agencyService = new AgencyService($this->agencyMapper);
+ return $agencyService->create(null, null, null, null, null, null, null, $agencygid, $agencydirid, $standarddirid);
+ }
+
+}
\ No newline at end of file
diff --git a/lib/Controller/AgencyController.php b/lib/Controller/AgencyController.php
index 5ee8052..cd5f4c9 100644
--- a/lib/Controller/AgencyController.php
+++ b/lib/Controller/AgencyController.php
@@ -10,23 +10,20 @@ use OCP\AppFramework\Http\JSONResponse;
use OCP\AppFramework\Controller;
use OCA\Agency\Service\AgencyService;
-use OCA\Agency\Service\AgencyUserService;
class AgencyController extends Controller {
protected $userManager;
private $service;
- private $agencyuserservice;
private $Id;
protected $userSession;
protected $request;
use Errors;
- public function __construct(string $AppName, IRequest $request, IUserSession $userSession, AgencyService $service, AgencyUserService $agencyuserservice){
+ public function __construct(string $AppName, IRequest $request, IUserSession $userSession, AgencyService $service){
parent::__construct($AppName, $request);
$this->service = $service;
- $this->agencyuserservice = $agencyuserservice;
$this->userSession = $userSession;
$this->request = $request;
}
@@ -38,16 +35,6 @@ class AgencyController extends Controller {
return new DataResponse($this->service->findAll($this->Id));
}
- /**
- * @NoAdminRequired
- * @NoCSRFRequired
- */
- public function getagencyidbyuser() {
- $user = $this->userSession->getUser()->getUid();
- $params = $this->agencyuserservice->getAgencyIdByUserUid($user);
- return new JSONResponse($params);
- }
-
/**
* @NoAdminRequired
* @NoCSRFRequired
@@ -63,11 +50,20 @@ class AgencyController extends Controller {
/**
* @NoAdminRequired
*
- * @param string $title
- * @param string $content
+ * @param string $name
+ * @param string $inhaber
+ * @param string $street
+ * @param string $plz
+ * @param string $city
+ * @param string $agencymail
+ * @param string $phone
+ * @param string $agencygid
+ * @param string $agencydirid
+ * @param string $standarddirid
+ *
*/
- public function create(string $name, string $inhaber, string $street, string $plz, string $city, string $agencymail, string $phone) {
- return $this->service->create($name, $inhaber, $street, $plz, $city, $agencymail, $phone);
+ public function create(string $name = null, string $inhaber = null, string $street = null, string $plz = null, string $city = null, string $agencymail = null, string $phone = null, string $agencygid, string $agencydirid, string $standarddirid) {
+ return $this->service->create($name, $inhaber, $street, $plz, $city, $agencymail, $phone, $agencygid, $agencydirid, $standarddirid);
}
/**
@@ -80,13 +76,7 @@ class AgencyController extends Controller {
public function update(int $id, string $name, string $inhaber, string $street, string $plz, string $city, string $agencymail, string $phone) {
return $this->handleNotFound(function () use ($id, $name, $inhaber, $street, $plz, $city, $agencymail, $phone) {
# TODO: ABfrage machen!
- if($this->agencyuserservice->checkAgencyIdUserId($this->userSession->getUser()->getUid(), $id)){
- return $this->service->update($id, $name, $inhaber, $street, $plz, $city, $agencymail, $phone);
- }
- else {
- return false;
- }
-
+ return $this->service->update($id, $name, $inhaber, $street, $plz, $city, $agencymail, $phone);
});
}
diff --git a/lib/Controller/TestController.php b/lib/Controller/TestController.php
new file mode 100644
index 0000000..f4a29c0
--- /dev/null
+++ b/lib/Controller/TestController.php
@@ -0,0 +1,36 @@
+appName = $appName;
+ $this->agencyManager = new AgencyManager($db);
+ }
+
+ /**
+ * @NoAdminRequired
+ * @NoCSRFRequired
+ */
+ public function filetest() {
+ # TODO: Diese Erstellung hier portieren, damit bei neuem User auch eine neue Agentur mit den Infos zur GruppenID und den Ordner-IDs für Standards und Dateien erstellt wird
+ return $this->agencyManager->createAgencyOnReg("0","0","0");
+ }
+
+}
\ No newline at end of file
diff --git a/lib/Db/Agency.php b/lib/Db/Agency.php
index 877ccbd..9fe3701 100644
--- a/lib/Db/Agency.php
+++ b/lib/Db/Agency.php
@@ -14,6 +14,9 @@ class Agency extends Entity implements JsonSerializable {
protected $city;
protected $agencymail;
protected $phone;
+ protected $agencygid;
+ protected $agencydirid;
+ protected $standarddirid;
public function __construct() {
$this->addType('id','integer');
@@ -29,6 +32,9 @@ class Agency extends Entity implements JsonSerializable {
'city' => $this->city,
'agencymail' => $this->agencymail,
'phone' => $this->phone,
+ 'agencygid' => $this->agencygid,
+ 'agencydirid' => $this->agencydirid,
+ 'standarddirid' => $this->standarddirid,
];
}
}
\ No newline at end of file
diff --git a/lib/Db/AgencyUser.php b/lib/Db/AgencyUser.php
deleted file mode 100644
index 275e4bf..0000000
--- a/lib/Db/AgencyUser.php
+++ /dev/null
@@ -1,24 +0,0 @@
-addType('id','integer');
- }
-
- public function jsonSerialize() {
- return [
- 'id' => $this->id,
- 'agency' => $this->agency,
- 'user' => $this->user,
- ];
- }
-}
\ No newline at end of file
diff --git a/lib/Db/AgencyUserMapper.php b/lib/Db/AgencyUserMapper.php
deleted file mode 100644
index 63ef13a..0000000
--- a/lib/Db/AgencyUserMapper.php
+++ /dev/null
@@ -1,34 +0,0 @@
-db->getQueryBuilder();
-
- $qb->select('*')
- ->from($this->getTableName())
- ->where(
- $qb->expr()->eq('id', $qb->createNamedParameter($id))
- );
- return $this->findEntity($qb);
- }
-
- public function getAgencyIdByUserUid(string $useruid) {
- $qb = $this->db->getQueryBuilder();
- $qb->select('*')
- ->from($this->getTableName())
- ->where(
- $qb->expr()->eq('user', $qb->createNamedParameter($useruid))
- );
- return $this->findEntity($qb);
- }
-}
\ No newline at end of file
diff --git a/lib/Service/AgencyService.php b/lib/Service/AgencyService.php
index 9171941..f8d2f12 100644
--- a/lib/Service/AgencyService.php
+++ b/lib/Service/AgencyService.php
@@ -37,7 +37,7 @@ class AgencyService {
}
//Create an Agency
- public function create(string $name, string $inhaber, string $street, string $plz, string $city, string $agencymail, string $phone) {
+ public function create(string $name = null, string $inhaber = null, string $street = null, string $plz = null, string $city = null, string $agencymail = null, string $phone = null, string $agencygid, string $agencydirid, string $standarddirid) {
$agency = new Agency();
$agency->setName($name);
$agency->setInhaber($inhaber);
@@ -46,6 +46,9 @@ class AgencyService {
$agency->setCity($city);
$agency->setAgencymail($agencymail);
$agency->setPhone($phone);
+ $agency->setAgencygid($agencygid);
+ $agency->setAgencydirid($agencydirid);
+ $agency->setStandarddirid($standarddirid);
return $this->mapper->insert($agency);
}
//Update an Agency
diff --git a/lib/Service/AgencyUserService.php b/lib/Service/AgencyUserService.php
deleted file mode 100644
index 260d301..0000000
--- a/lib/Service/AgencyUserService.php
+++ /dev/null
@@ -1,53 +0,0 @@
-mapper = $mapper;
- }
-
- private function handleException ($e) {
- if ($e instanceof DoesNotExistException ||
- $e instanceof MultipleObjectsReturnedException) {
- throw new NotFoundException($e->getMessage());
- } else {
- throw $e;
- }
- }
-
- //Find an Agency-User
- public function find(int $id) {
- try {
- return $this->mapper->find($id);
- } catch(Exception $e) {
- $this->handleException($e);
- }
- }
-
- //Find an Agency-User
- public function getAgencyIdByUserUid(string $useruid) {
- try {
- return $this->mapper->getAgencyIdByUserUid($useruid);
- } catch(Exception $e) {
- $this->handleException($e);
- }
- }
-
- //Checks, if a given User is in given Agency. Use for secure reason to make save, that agencydata is only changed by user which belongs to that agency.
- public function checkAgencyIdUserId(string $useruid, int $agencyid){
- # TODO: Hier einmal prüfen, dass der eingeloggte Nutzer auch zur angefragten Agentur passt!
- return false;
- }
-}
\ No newline at end of file
diff --git a/src/components/Navigation.vue b/src/components/Navigation.vue
index 37cc7d5..b370557 100644
--- a/src/components/Navigation.vue
+++ b/src/components/Navigation.vue
@@ -7,6 +7,9 @@
+
diff --git a/src/router/routes.js b/src/router/routes.js
index 28015f4..d479c31 100644
--- a/src/router/routes.js
+++ b/src/router/routes.js
@@ -1,4 +1,5 @@
import AgencyData from '../views/AgencyData'
+import Testing from '../views/Testing'
import GroupManagement from '../views/GroupManagement'
export default [
@@ -12,4 +13,9 @@ export default [
name: 'groupmanagemenet',
component: GroupManagement,
},
+ {
+ path: '/testing',
+ name: 'testing',
+ component: Testing,
+ },
]
diff --git a/src/views/Testing.vue b/src/views/Testing.vue
new file mode 100644
index 0000000..e8cfde0
--- /dev/null
+++ b/src/views/Testing.vue
@@ -0,0 +1,37 @@
+
+
+
+ Allgemeine Tests für den ganzen stuff
+
+
+
+
+