Skip to content

Commit

Permalink
Merge pull request #17 from ConductionNL/dev-gino
Browse files Browse the repository at this point in the history
updates to id-vault
  • Loading branch information
ginokok1996 authored Oct 26, 2020
2 parents 1cb90a2 + f1120a5 commit 129fcea
Show file tree
Hide file tree
Showing 22 changed files with 1,384 additions and 169 deletions.
34 changes: 17 additions & 17 deletions api/config/bundles.php
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
<?php

return [
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true],
Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true],
Symfony\Bundle\MercureBundle\MercureBundle::class => ['all' => true],
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
ApiPlatform\Core\Bridge\Symfony\Bundle\ApiPlatformBundle::class => ['all' => true],
Nelmio\CorsBundle\NelmioCorsBundle::class => ['all' => true],
Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true],
Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true],
Conduction\CommonGroundBundle\CommonGroundBundle::class => ['all' => true],
Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle::class => ['all' => true],
Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle::class => ['all' => true],
Tbbc\MoneyBundle\TbbcMoneyBundle::class => ['all' => true],
Knp\Bundle\MarkdownBundle\KnpMarkdownBundle::class => ['all' => true],
Endroid\QrCodeBundle\EndroidQrCodeBundle::class => ['all' => true],
Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true],
Conduction\LandkitBundle\LandkitBundle::class => ['all' => true],
Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true],
Symfony\Bundle\MercureBundle\MercureBundle::class => ['all' => true],
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
ApiPlatform\Core\Bridge\Symfony\Bundle\ApiPlatformBundle::class => ['all' => true],
Nelmio\CorsBundle\NelmioCorsBundle::class => ['all' => true],
Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true],
Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true],
Conduction\CommonGroundBundle\CommonGroundBundle::class => ['all' => true],
Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle::class => ['all' => true],
Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle::class => ['all' => true],
Tbbc\MoneyBundle\TbbcMoneyBundle::class => ['all' => true],
Knp\Bundle\MarkdownBundle\KnpMarkdownBundle::class => ['all' => true],
Endroid\QrCodeBundle\EndroidQrCodeBundle::class => ['all' => true],
Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true],
Conduction\LandkitBundle\LandkitBundle::class => ['all' => true],
];
Binary file modified api/helm/id-vault-0.1.0.tgz
Binary file not shown.
6 changes: 3 additions & 3 deletions api/helm/index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ entries:
id-vault:
- apiVersion: v1
appVersion: V1.0
created: "2020-10-23T14:30:34.4787658Z"
created: "2020-10-26T15:32:51.2323743Z"
description: Naast deze JSON rest API is er ook een [graphql](/graphql) interface
beschikbaar.
digest: 33bf3d12c96c2a7b8afb39d31e987ee9c351be3bedb5f8d7b2226ec23c8bccbb
digest: 9d8ec7a00b8963e9262e928f3423081ee57d37c324525e91cb1c5234225278a6
home: www.id-vault.com
icon: www.id-vault.com
name: id-vault
urls:
- id-vault-0.1.0.tgz
version: 0.1.0
generated: "2020-10-23T14:30:34.4450228Z"
generated: "2020-10-26T15:32:51.2252936Z"
8 changes: 4 additions & 4 deletions api/public/schema/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2391,12 +2391,12 @@ definitions:
description: 'The moment this request was created'
type: string
format: date-time
example: '2020-10-23 14:38:49'
example: '2020-10-26 15:33:38'
dateModified:
description: 'The moment this request last Modified'
type: string
format: date-time
example: '2020-10-23 14:38:49'
example: '2020-10-26 15:33:38'
required: []
AuditTrail-write:
properties:
Expand Down Expand Up @@ -2444,12 +2444,12 @@ definitions:
description: 'The moment this request was created'
type: string
format: date-time
example: '2020-10-23 14:38:49'
example: '2020-10-26 15:33:38'
dateModified:
description: 'The moment this request last Modified'
type: string
format: date-time
example: '2020-10-23 14:38:49'
example: '2020-10-26 15:33:38'
required: []
ChangeLog-write:
properties:
Expand Down
2 changes: 1 addition & 1 deletion api/public/schema/publiccode.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ url: "https://github.com/ConductionNL/id-vault"
landingURL: "dev.id-vault.com"
isBasedOn: "https://github.com/ConductionNL/Proto-component-commonground.git"
softwareVersion: "V1.0"
releaseDate: "2020-23-10"
releaseDate: "2020-26-10"
logo: www.id-vault.com
monochromeLogo: img/logo-mono.svg

Expand Down
114 changes: 106 additions & 8 deletions api/src/Controller/DashboardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use Conduction\CommonGroundBundle\Service\ApplicationService;
//use App\Service\RequestService;
use Conduction\CommonGroundBundle\Service\CommonGroundService;
use function GuzzleHttp\Promise\all;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
Expand All @@ -33,13 +32,26 @@ public function generalAction(Session $session, Request $request, CommonGroundSe
{
$variables = [];

// if ($request->isMethod('POST')) {
// $user = $this->getUser();
// $user['userGroups'] = [
// '/groups/c3c463b9-8d39-4cc0-b62c-826d8f5b7d8c',
// ];
// $commonGroundService->updateResource();
// }
// Set current user to userGroup developer
if ($request->isMethod('POST')) {
$person = $this->getUser()->getPerson();
$users = $commonGroundService->getResourceList(['component' => 'uc', 'type' => 'users'], ['person' => $person])['hydra:member'];
if (count($users) > 0) {
$user = $users[0];

$userGroups = [];
foreach ($user['userGroups'] as $userGroup) {
if ($userGroup['id'] != 'c3c463b9-8d39-4cc0-b62c-826d8f5b7d8c') {
array_push($userGroups, '/groups/'.$userGroup['id']);
}
}

$user['userGroups'] = $userGroups;
$user['userGroups'][] = '/groups/c3c463b9-8d39-4cc0-b62c-826d8f5b7d8c';

$commonGroundService->updateResource($user);
}
}

return $variables;
}
Expand Down Expand Up @@ -109,6 +121,92 @@ public function organizationsAction(Session $session, Request $request, CommonGr
{
$variables = [];

if ($request->isMethod('POST')) {
$name = $request->get('name');
$email = $request->get('email');
$description = $request->get('description');

$cc = [];
$cc['name'] = $name;
$cc['description'] = $description;
$cc['emails'][0]['email'] = $email;

$cc = $commonGroundService->createResource($cc, ['component' => 'cc', 'type' => 'organizations']);

$wrc = [];
$wrc['rsin'] = ' ';
$wrc['chamberOfComerce'] = ' ';
$wrc['name'] = $name;
$wrc['description'] = $description;
$wrc['contact'] = $commonGroundService->cleanUrl(['component' => 'cc', 'type' => 'organizations', 'id' => $cc['id']]);
if (isset($_FILES['logo']) && $_FILES['logo']['error'] !== 4) {
$path = $_FILES['logo']['tmp_name'];
$type = filetype($_FILES['logo']['tmp_name']);
$data = file_get_contents($path);
$wrc['style']['name'] = 'style for '.$name;
$wrc['style']['description'] = 'style for '.$name;
$wrc['style']['css'] = ' ';
$wrc['style']['favicon']['name'] = 'logo for '.$name;
$wrc['style']['favicon']['description'] = 'logo for '.$name;
$wrc['style']['favicon']['base64'] = 'data:image/'.$type.';base64,'.base64_encode($data);
}

$wrc = $commonGroundService->createResource($wrc, ['component' => 'wrc', 'type' => 'organizations']);

$userGroup = [];
$userGroup['name'] = $name;
$userGroup['title'] = $name;
$userGroup['description'] = 'group for '.$name;
$userGroup['organization'] = $commonGroundService->cleanUrl(['component' => 'wrc', 'type' => 'organizations', 'id' => $wrc['id']]);

$group = $commonGroundService->createResource($userGroup, ['component' => 'uc', 'type' => 'groups']);

$users = $commonGroundService->getResourceList(['component' => 'uc', 'type' => 'users'], ['username' => $this->getUser()->getUsername()])['hydra:member'];
if (count($users) > 0) {
$organizations = [];
$user = $users[0];

$userGroups = [];
foreach ($user['userGroups'] as $userGroup) {
array_push($userGroups, '/groups/'.$userGroup['id']);
}

$user['userGroups'] = $userGroups;
$user['userGroups'][] = '/groups/'.$group['id'];

$commonGroundService->updateResource($user);
}
}

if ($this->getUser()) {
$users = $commonGroundService->getResourceList(['component' => 'uc', 'type' => 'users'], ['username' => $this->getUser()->getUsername()])['hydra:member'];
if (count($users) > 0) {
$organizations = [];
$user = $users[0];
foreach ($user['userGroups'] as $group) {
$organization = $commonGroundService->getResource($group['organization']);
if (!in_array($organization, $organizations)) {
$organizations[] = $organization;
}
}
$variables['resources'] = $organizations;
}
}

return $variables;
}

/**
* @Route("/organizations/{id}")
* @Template
*/
public function organizationAction(Session $session, Request $request, CommonGroundService $commonGroundService, ApplicationService $applicationService, ParameterBagInterface $params, string $slug = 'home')
{
$variables = [];

if ($request->isMethod('POST')) {
}

return $variables;
}

Expand Down
33 changes: 31 additions & 2 deletions api/src/Controller/DefaultController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
use Conduction\CommonGroundBundle\Service\ApplicationService;
//use App\Service\RequestService;
use Conduction\CommonGroundBundle\Service\CommonGroundService;
use function GuzzleHttp\Promise\all;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
Expand Down Expand Up @@ -91,5 +89,36 @@ public function developersAction(Session $session, Request $request, CommonGroun
return $variables;
}

/**
* @Route("/terms")
* @Template
*/
public function termsAction(Session $session, Request $request, CommonGroundService $commonGroundService, ApplicationService $applicationService, ParameterBagInterface $params, string $slug = 'home')
{
$variables = [];

return $variables;
}

/**
* @Route("/privacy")
* @Template
*/
public function privacyAction(Session $session, Request $request, CommonGroundService $commonGroundService, ApplicationService $applicationService, ParameterBagInterface $params, string $slug = 'home')
{
$variables = [];

return $variables;
}

/**
* @Route("/pricing")
* @Template
*/
public function pricingAction(Session $session, Request $request, CommonGroundService $commonGroundService, ApplicationService $applicationService, ParameterBagInterface $params, string $slug = 'home')
{
$variables = [];

return $variables;
}
}
3 changes: 0 additions & 3 deletions api/src/Controller/DocumentationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
use Conduction\CommonGroundBundle\Service\ApplicationService;
//use App\Service\RequestService;
use Conduction\CommonGroundBundle\Service\CommonGroundService;
use function GuzzleHttp\Promise\all;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
Expand Down Expand Up @@ -57,5 +55,4 @@ public function exampleAction(Session $session, Request $request, CommonGroundSe

return $variables;
}

}
4 changes: 2 additions & 2 deletions api/src/Controller/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
/**
* Class UserController.
*
* @Route("/user")
* @Route("/user")
*/
class UserController extends AbstractController
{
Expand Down Expand Up @@ -66,10 +66,10 @@ public function login(

if ($this->getUser()) {
$this->flash->add('success', 'Welcome '.$this->getUser()->getName());

return $this->redirect($this->generateUrl('app_default_index'));
} else {
return $this->redirect($this->generateUrl('app_default_index'));

}
}

Expand Down
2 changes: 1 addition & 1 deletion api/templates/base.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
{% for message in messages %}
{% if message not in flashes %}
{% set flashes = flashes|merge([message]) %}
<div class="alert alert-{{ label }} rounded-0 mb-0">
<div class="alert alert-{% if label == 'error' %}{% set label = 'danger' %}{% endif %}{{ label }} rounded-0 mb-0">
<div class="container-md">
<div class="row">
<div class="col-12">
Expand Down
Loading

0 comments on commit 129fcea

Please sign in to comment.