├── .gitignore
├── Gruntfile.js
├── LICENSE
├── Procfile
├── README.md
├── app
├── .htaccess
├── AppCache.php
├── AppKernel.php
├── BootCampKernel.php
├── DoctrineMigrations
│ ├── Version20140731100000.php
│ ├── Version20140731135018.php
│ ├── Version20140731150213.php
│ ├── Version20140731151542.php
│ ├── Version20140731153316.php
│ ├── Version20140731155704.php
│ ├── Version20141129182419.php
│ ├── Version20150311093354.php
│ └── Version20150314111201.php
├── Resources
│ └── views
│ │ ├── base.html.twig
│ │ └── forms.html.twig
├── SymfonyRequirements.php
├── autoload.php
├── check.php
├── config
│ ├── config.yml
│ ├── config_bootcamp.yml
│ ├── config_dev.yml
│ ├── config_prod.yml
│ ├── config_test.yml
│ ├── defaults
│ │ ├── data.environment.dist.yml
│ │ └── data.parameters.dist.yml
│ ├── environment.yml
│ ├── parameters.yml
│ ├── routing.yml
│ ├── routing_dev.yml
│ └── security.yml
├── console
├── logs
│ └── .gitkeep
└── phpunit.xml.dist
├── bower.json
├── composer.json
├── composer.lock
├── data
└── .gitkeep
├── docker
├── Dockerfile
├── README.md
├── baikal.conf
└── docker-compose.yml
├── package.json
├── scalingo.json
├── src
├── .htaccess
├── Baikal
│ ├── AdminBundle
│ │ ├── BaikalAdminBundle.php
│ │ ├── Controller
│ │ │ ├── Addressbook
│ │ │ │ ├── FormController.php
│ │ │ │ ├── ListController.php
│ │ │ │ └── ViewController.php
│ │ │ ├── Application
│ │ │ │ ├── FormController.php
│ │ │ │ └── ListController.php
│ │ │ ├── AuthController.php
│ │ │ ├── Calendar
│ │ │ │ ├── FormController.php
│ │ │ │ ├── InstructionsController.php
│ │ │ │ ├── ListController.php
│ │ │ │ └── ViewController.php
│ │ │ ├── DashboardController.php
│ │ │ ├── SettingsController.php
│ │ │ └── User
│ │ │ │ ├── FormController.php
│ │ │ │ ├── InfoController.php
│ │ │ │ └── ListController.php
│ │ ├── DependencyInjection
│ │ │ ├── Configuration.php
│ │ │ └── NetgustoBaikalAdminExtension.php
│ │ ├── Menu
│ │ │ └── Builder.php
│ │ ├── Resources
│ │ │ ├── config
│ │ │ │ ├── config.yml
│ │ │ │ ├── routing.yml
│ │ │ │ └── services.yml
│ │ │ ├── doc
│ │ │ │ └── index.rst
│ │ │ ├── sources
│ │ │ │ └── less
│ │ │ │ │ └── style.less
│ │ │ ├── translations
│ │ │ │ └── messages.fr.xlf
│ │ │ └── views
│ │ │ │ ├── Addressbook
│ │ │ │ ├── form.html.twig
│ │ │ │ ├── list.html.twig
│ │ │ │ └── view.html.twig
│ │ │ │ ├── Application
│ │ │ │ ├── form.html.twig
│ │ │ │ └── list.html.twig
│ │ │ │ ├── Auth
│ │ │ │ └── loginform.html.twig
│ │ │ │ ├── Calendar
│ │ │ │ ├── form.html.twig
│ │ │ │ ├── instructions.html.twig
│ │ │ │ ├── list.html.twig
│ │ │ │ └── view.html.twig
│ │ │ │ ├── Dashboard
│ │ │ │ └── index.html.twig
│ │ │ │ ├── Layouts
│ │ │ │ ├── fullscreen.html.twig
│ │ │ │ ├── partials
│ │ │ │ │ ├── _footer.html.twig
│ │ │ │ │ └── _header.html.twig
│ │ │ │ └── standard.html.twig
│ │ │ │ ├── Settings
│ │ │ │ └── index.html.twig
│ │ │ │ └── User
│ │ │ │ ├── form.html.twig
│ │ │ │ ├── info.html.twig
│ │ │ │ └── list.html.twig
│ │ └── Service
│ │ │ └── AccessDeniedHandler.php
│ ├── BootCampBundle
│ │ ├── BaikalBootCampBundle.php
│ │ ├── DependencyInjection
│ │ │ ├── BaikalBootCampExtension.php
│ │ │ └── Configuration.php
│ │ ├── InitHandler
│ │ │ ├── ConfigInitHandler.php
│ │ │ └── UserInitHandler.php
│ │ └── Resources
│ │ │ └── config
│ │ │ └── services.yml
│ ├── FrontendBundle
│ │ ├── BaikalFrontendBundle.php
│ │ ├── Controller
│ │ │ ├── Addressbook
│ │ │ │ ├── FormController.php
│ │ │ │ ├── ListController.php
│ │ │ │ └── ViewController.php
│ │ │ ├── AuthController.php
│ │ │ ├── Calendar
│ │ │ │ ├── FormController.php
│ │ │ │ ├── InstructionsController.php
│ │ │ │ ├── ListController.php
│ │ │ │ └── ViewController.php
│ │ │ ├── DashboardController.php
│ │ │ └── ProfileController.php
│ │ ├── DependencyInjection
│ │ │ ├── Configuration.php
│ │ │ └── NetgustoBaikalFrontendExtension.php
│ │ ├── Form
│ │ │ └── Type
│ │ │ │ ├── Calendar
│ │ │ │ └── CalendarType.php
│ │ │ │ └── User
│ │ │ │ └── EditUserType.php
│ │ ├── Menu
│ │ │ └── Builder.php
│ │ ├── Resources
│ │ │ ├── config
│ │ │ │ ├── config.yml
│ │ │ │ ├── routing.yml
│ │ │ │ └── services.yml
│ │ │ ├── doc
│ │ │ │ └── index.rst
│ │ │ ├── public
│ │ │ │ └── css
│ │ │ │ │ └── style.css
│ │ │ ├── translations
│ │ │ │ └── messages.fr.xlf
│ │ │ └── views
│ │ │ │ ├── Addressbook
│ │ │ │ ├── form.html.twig
│ │ │ │ ├── list.html.twig
│ │ │ │ └── view.html.twig
│ │ │ │ ├── Auth
│ │ │ │ ├── loginform.html.twig
│ │ │ │ └── oauthloginform.html.twig
│ │ │ │ ├── Calendar
│ │ │ │ ├── form.html.twig
│ │ │ │ ├── instructions.html.twig
│ │ │ │ ├── list.html.twig
│ │ │ │ └── view.html.twig
│ │ │ │ ├── Dashboard
│ │ │ │ └── index.html.twig
│ │ │ │ ├── Layouts
│ │ │ │ ├── fullscreen.html.twig
│ │ │ │ ├── partials
│ │ │ │ │ ├── _footer.html.twig
│ │ │ │ │ └── _header.html.twig
│ │ │ │ └── standard.html.twig
│ │ │ │ └── Profile
│ │ │ │ └── index.html.twig
│ │ └── Service
│ │ │ ├── AccessDeniedHandler.php
│ │ │ └── OAuthPreLoginRedirectFormAuthenticationEntryPoint.php
│ ├── SystemBundle
│ │ ├── BaikalSystemBundle.php
│ │ ├── Controller
│ │ │ └── SecurityController.php
│ │ ├── DependencyInjection
│ │ │ ├── BaikalSystemExtension.php
│ │ │ └── Configuration.php
│ │ ├── Entity
│ │ │ └── User.php
│ │ ├── Resources
│ │ │ ├── config
│ │ │ │ ├── config.yml
│ │ │ │ ├── doctrine
│ │ │ │ │ └── User.orm.yml
│ │ │ │ └── services.yml
│ │ │ ├── public
│ │ │ │ └── img
│ │ │ │ │ ├── baikal-logo.svg
│ │ │ │ │ └── matriochka.svg
│ │ │ └── views
│ │ │ │ └── Security
│ │ │ │ └── accessDenied.html.twig
│ │ └── Services
│ │ │ ├── AbstractConfigService.php
│ │ │ ├── ConfigLoader
│ │ │ ├── AbstractConfigLoaderService.php
│ │ │ ├── DbBackedConfigLoaderService.php
│ │ │ └── FileBackedConfigLoaderService.php
│ │ │ └── MainConfigService.php
│ └── ViewComponentsBundle
│ │ ├── BaikalViewComponentsBundle.php
│ │ ├── DependencyInjection
│ │ ├── BaikalViewComponentsExtension.php
│ │ └── Configuration.php
│ │ ├── Resources
│ │ ├── config
│ │ │ └── services.yml
│ │ ├── public
│ │ │ └── img
│ │ │ │ ├── baikal-logo.svg
│ │ │ │ └── matriochka.svg
│ │ └── views
│ │ │ ├── Components
│ │ │ ├── Addressbook
│ │ │ │ ├── form.html.twig
│ │ │ │ └── list.html.twig
│ │ │ ├── Calendar
│ │ │ │ ├── form.html.twig
│ │ │ │ ├── form.scripts.html.twig
│ │ │ │ ├── instructions.html.twig
│ │ │ │ └── list.html.twig
│ │ │ ├── Dashboard
│ │ │ │ └── license.html.twig
│ │ │ ├── SPA
│ │ │ │ ├── calclient.html.twig
│ │ │ │ └── cardclient.html.twig
│ │ │ ├── User
│ │ │ │ └── list.html.twig
│ │ │ ├── addbutton.html.twig
│ │ │ ├── avatar.textsize.html.twig
│ │ │ ├── calendarpill.html.twig
│ │ │ ├── flash.notice.html.twig
│ │ │ ├── list.html.twig
│ │ │ ├── list.scripts.html.twig
│ │ │ ├── loginform.html.twig
│ │ │ ├── modal.html.twig
│ │ │ ├── nothinghere.html.twig
│ │ │ └── pageheader.html.twig
│ │ │ ├── Layouts
│ │ │ ├── fullpage.html.twig
│ │ │ └── standard.html.twig
│ │ │ └── Menu
│ │ │ └── topmenu.html.twig
│ │ ├── Services
│ │ └── FormHandler
│ │ │ ├── AddressbookFormHandler.php
│ │ │ ├── ApplicationFormHandler.php
│ │ │ └── CalendarFormHandler.php
│ │ └── Twig
│ │ ├── BaikalExtension.php
│ │ └── MenuExtension.php
└── Netgusto
│ └── PortalBundle
│ ├── DependencyInjection
│ ├── Configuration.php
│ └── NetgustoPortalExtension.php
│ ├── NetgustoPortalBundle.php
│ ├── Resources
│ └── config
│ │ └── services.yml
│ └── Twig
│ └── PortalExtension.php
└── web
├── .htaccess
├── app.php
├── app_dev.php
├── apple-touch-icon.png
├── apps
└── calclient-month
│ ├── .bowerrc
│ ├── .editorconfig
│ ├── .ember-cli
│ ├── .jshintrc
│ ├── .travis.yml
│ ├── .yo-rc.json
│ ├── Brocfile.js
│ ├── README.md
│ ├── app
│ ├── app.js
│ ├── components
│ │ └── event-form.coffee
│ ├── controllers
│ │ ├── .gitkeep
│ │ └── index.js
│ ├── index.html
│ ├── initializers
│ │ └── config.js
│ ├── router.js
│ ├── styles
│ │ ├── .gitkeep
│ │ └── app.css
│ └── templates
│ │ ├── .gitkeep
│ │ ├── application.hbs
│ │ ├── components
│ │ └── event-form.hbs
│ │ └── index.hbs
│ ├── bower.json
│ ├── config
│ └── environment.js
│ ├── dist
│ ├── .gitkeep
│ ├── assets
│ │ ├── ember-cli-cal-demoapp.css
│ │ ├── ember-cli-cal-demoapp.js
│ │ ├── failed.png
│ │ ├── passed.png
│ │ ├── test-loader.js
│ │ ├── test-support.css
│ │ ├── test-support.js
│ │ ├── vendor.css
│ │ └── vendor.js
│ ├── crossdomain.xml
│ ├── index.html
│ ├── robots.txt
│ ├── testem.js
│ └── tests
│ │ └── index.html
│ ├── package.json
│ ├── public
│ ├── .gitkeep
│ ├── crossdomain.xml
│ └── robots.txt
│ ├── testem.json
│ ├── tests
│ ├── .jshintrc
│ ├── helpers
│ │ ├── resolver.js
│ │ └── start-app.js
│ ├── index.html
│ ├── test-helper.js
│ └── unit
│ │ ├── .gitkeep
│ │ └── controllers
│ │ └── index-test.js
│ └── vendor
│ └── .gitkeep
├── assets
├── css
│ ├── bootstrap.css
│ ├── bundled.css
│ ├── bundled.min.css
│ ├── font-awesome.css
│ └── jquery.minicolors.css
├── dist
│ ├── buddies.min.js
│ ├── buddies.min.js.gz
│ ├── bundled.css
│ ├── bundled.js
│ ├── bundled.min.css
│ ├── bundled.min.css.gz
│ ├── bundled.min.js
│ ├── bundled.min.js.gz
│ ├── pulpy.min.js
│ └── pulpy.min.js.gz
├── fonts
│ ├── FontAwesome.otf
│ ├── fontawesome-webfont.eot
│ ├── fontawesome-webfont.svg
│ ├── fontawesome-webfont.ttf
│ ├── fontawesome-webfont.woff
│ └── fontawesome-webfont.woff2
├── images
│ ├── baikal-logo.svg
│ └── matriochka.svg
└── js
│ ├── bootstrap.js
│ ├── bundled.js
│ ├── bundled.min.js
│ ├── jquery.js
│ └── jquery.minicolors.min.js
├── config.php
├── favicon.ico
└── robots.txt
/.gitignore:
--------------------------------------------------------------------------------
1 | /web/bundles/
2 | /web/vendor/
3 | /web/css/
4 | /web/js/
5 | /app/bootstrap.php.cache
6 | /app/cache/*
7 | /app/logs/*
8 | !app/cache/.gitkeep
9 | !app/logs/.gitkeep
10 | /data/*
11 | !data/.gitkeep
12 | /build/
13 | /vendor/
14 | /bin/
15 | /composer.phar
16 |
17 | /web/apps/*
18 |
19 | /node_modules
20 | /bower_components
21 | /npm-debug.log
22 |
--------------------------------------------------------------------------------
/Procfile:
--------------------------------------------------------------------------------
1 | web: bin/heroku-php-apache2 web/
--------------------------------------------------------------------------------
/app/.htaccess:
--------------------------------------------------------------------------------
1 |
2 | Require all denied
3 |
4 |
5 | Order deny,allow
6 | Deny from all
7 |
8 |
--------------------------------------------------------------------------------
/app/AppCache.php:
--------------------------------------------------------------------------------
1 | getEnvironment(), array('dev', 'test'))) {
47 | $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
48 | $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
49 | #$bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
50 | }
51 |
52 | return $bundles;
53 | }
54 |
55 | public function registerContainerConfiguration(LoaderInterface $loader)
56 | {
57 | $loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml');
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/app/BootCampKernel.php:
--------------------------------------------------------------------------------
1 | createTable('BootCampStatus');
17 |
18 | $bootcampstatus->addColumn('id', 'integer')->setAutoincrement(true);
19 |
20 | $bootcampstatus->addColumn('configuredversion', 'string', array(
21 | 'length' => 32,
22 | ));
23 |
24 | $bootcampstatus->setPrimaryKey(array('id'));
25 | }
26 |
27 | public function down(Schema $schema) {
28 |
29 | }
30 | }
--------------------------------------------------------------------------------
/app/DoctrineMigrations/Version20140731150213.php:
--------------------------------------------------------------------------------
1 | createTable('locks');
17 |
18 | $locks->addColumn('id', 'integer')->setAutoincrement(true);
19 |
20 | $locks->addColumn('owner', 'string', array(
21 | 'length' => 100,
22 | 'notnull' => false,
23 | ));
24 |
25 | $locks->addColumn('timeout', 'integer', array(
26 | 'notnull' => false,
27 | ));
28 |
29 | $locks->addColumn('created', 'integer', array(
30 | 'notnull' => false,
31 | ));
32 |
33 | $locks->addColumn('token', 'string', array(
34 | 'length' => 100,
35 | 'notnull' => false,
36 | ));
37 |
38 | $locks->addColumn('scope', 'integer', array(
39 | 'notnull' => false,
40 | ));
41 |
42 | $locks->addColumn('depth', 'integer', array(
43 | 'notnull' => false,
44 | ));
45 |
46 | $locks->addColumn('uri', 'string', array(
47 | 'length' => 1000,
48 | 'notnull' => false,
49 | ));
50 |
51 | $locks->setPrimaryKey(array('id'));
52 |
53 | $locks->addIndex(array('token'));
54 |
55 | #######################################################################
56 | # Baikal\DavServicesBundle\Entity\PropertyStorage
57 | #######################################################################
58 |
59 | $propertystorage = $schema->createTable('propertystorage');
60 |
61 | $propertystorage->addColumn('id', 'integer')->setAutoincrement(true);
62 |
63 | $propertystorage->addColumn('path', 'string', array(
64 | 'length' => 1024,
65 | ));
66 |
67 | $propertystorage->addColumn('name', 'string', array(
68 | 'length' => 100,
69 | ));
70 |
71 | $propertystorage->addColumn('value', 'blob');
72 |
73 | $propertystorage->setPrimaryKey(array('id'));
74 | }
75 |
76 | public function down(Schema $schema) {
77 | $schema->dropTable('locks');
78 | $schema->dropTable('groupmembers');
79 | }
80 | }
81 |
--------------------------------------------------------------------------------
/app/DoctrineMigrations/Version20140731155704.php:
--------------------------------------------------------------------------------
1 | createTable('ConfigContainer');
17 |
18 | $configcontainer->addColumn('id', 'integer')->setAutoincrement(true);
19 |
20 | $configcontainer->addColumn('name', 'string', array(
21 | 'length' => 255,
22 | ));
23 |
24 | $configcontainer->addColumn('config', 'json_array');
25 |
26 | $configcontainer->setPrimaryKey(array('id'));
27 | }
28 |
29 | public function down(Schema $schema) {
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/app/DoctrineMigrations/Version20150311093354.php:
--------------------------------------------------------------------------------
1 | getTable('calendarobjects');
21 | $calendarobjects->addColumn('uid', 'string', array(
22 | 'notnull' => false,
23 | ));
24 |
25 | $schedulingobjects = $schema->createTable('schedulingobjects');
26 | $schedulingobjects->addColumn('id', 'integer')->setAutoincrement(true);
27 |
28 | $schedulingobjects->addColumn('principaluri', 'string', array(
29 | 'length' => 255,
30 | 'notnull' => false,
31 | ));
32 |
33 | $schedulingobjects->addColumn('calendardata', 'text', array(
34 | 'notnull' => false,
35 | ));
36 |
37 | $schedulingobjects->addColumn('uri', 'string', array(
38 | 'length' => 200,
39 | 'notnull' => false,
40 | ));
41 |
42 | $schedulingobjects->addColumn('lastmodified', 'integer', array(
43 | 'notnull' => false,
44 | ));
45 |
46 | $schedulingobjects->addColumn('etag', 'string', array(
47 | 'length' => 255,
48 | 'notnull' => false,
49 | ));
50 |
51 | $schedulingobjects->addColumn('size', 'integer', array(
52 | 'notnull' => false,
53 | ));
54 |
55 | $schedulingobjects->setPrimaryKey(array('id'));
56 |
57 | }
58 |
59 | /**
60 | * @param Schema $schema
61 | */
62 | public function down(Schema $schema)
63 | {
64 | // this down() migration is auto-generated, please modify it to your needs
65 |
66 | $calendarobjects = $schema->getTable('calendarobjects');
67 | $calendarobjects->removeColumn('uid');
68 |
69 | $schema->dropTable('schedulingobjects');
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/app/Resources/views/base.html.twig:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {% block title %}Welcome!{% endblock %}
6 | {% block stylesheets %}{% endblock %}
7 |
8 |
9 |
10 | {% block body %}{% endblock %}
11 | {% block javascripts %}{% endblock %}
12 |
13 |
14 |
--------------------------------------------------------------------------------
/app/autoload.php:
--------------------------------------------------------------------------------
1 | getParameterOption(array('--env', '-e'), getenv('SYMFONY_ENV') ?: 'dev');
19 | $debug = getenv('SYMFONY_DEBUG') !== '0' && !$input->hasParameterOption(array('--no-debug', '')) && $env !== 'prod';
20 |
21 | if ($debug) {
22 | Debug::enable();
23 | }
24 |
25 | $kernel = new AppKernel($env, $debug);
26 | $application = new Application($kernel);
27 | $application->run($input);
28 |
--------------------------------------------------------------------------------
/app/logs/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sabre-io/Baikal2/b5142938b8e5dde693f31ff52e061f2d2810aee2/app/logs/.gitkeep
--------------------------------------------------------------------------------
/app/phpunit.xml.dist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 | ../src/*/*Bundle/Tests
13 | ../src/*/Bundle/*Bundle/Tests
14 |
15 |
16 |
17 |
22 |
23 |
24 |
25 | ../src
26 |
27 | ../src/*/*Bundle/Resources
28 | ../src/*/*Bundle/Tests
29 | ../src/*/Bundle/*Bundle/Resources
30 | ../src/*/Bundle/*Bundle/Tests
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/bower.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "netgusto-baikal",
3 | "dependencies": {
4 | "jquery": "1.11.*",
5 | "bootstrap": "3.3.*",
6 | "font-awesome": "4.3.*",
7 | "jquery-minicolors": "2.1.*",
8 | "pulpy": "0.0.3-dev",
9 | "buddies": "0.0.2-dev"
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/data/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sabre-io/Baikal2/b5142938b8e5dde693f31ff52e061f2d2810aee2/data/.gitkeep
--------------------------------------------------------------------------------
/docker/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM ubuntu:14.04
2 |
3 | # Requirements
4 | RUN apt-get update && apt-get install -y php5 php5-curl php5-sqlite curl git apache2
5 |
6 | # Set up baikal
7 | WORKDIR /var/www
8 | RUN git clone -b branch-2 https://github.com/netgusto/Baikal.git baikal
9 | RUN chown -R www-data:www-data baikal
10 | RUN chmod -R 775 baikal
11 |
12 | WORKDIR /var/www/baikal
13 | RUN cp app/config/defaults/data.parameters.dist.yml data/parameters.yml
14 | RUN cp app/config/defaults/data.environment.dist.yml data/environment.yml
15 | RUN curl -sS https://getcomposer.org/installer | php
16 | RUN php composer.phar install --optimize-autoloader
17 |
18 | WORKDIR /var/www/baikal/app/cache
19 | RUN mkdir prod
20 |
21 | WORKDIR /var/www
22 | RUN chown -R www-data:www-data baikal
23 | RUN chmod -R 775 baikal
24 |
25 | # apache2 conf
26 | RUN rm /etc/apache2/sites-enabled/000-default.conf
27 | COPY baikal.conf /etc/apache2/sites-available/
28 | RUN ln -s /etc/apache2/sites-available/baikal.conf /etc/apache2/sites-enabled/baikal.conf
29 | RUN echo "ServerName localhost" >> /etc/apache2/apache2.conf
30 |
31 | EXPOSE 8000
32 | CMD ["/usr/sbin/apache2ctl", "-D", "FOREGROUND"]
33 |
--------------------------------------------------------------------------------
/docker/README.md:
--------------------------------------------------------------------------------
1 | # Baikal & Docker
2 |
3 | ## Build the image :
4 | Clone Baikal go to the Docker folder and execute :
5 |
6 | `docker build -t mySuperImageName .`
7 |
8 | When done, run the images by doing :
9 |
10 | `docker run -ti -p 8000:80 mySuperImageName`
11 |
12 | Or start it as a daemon with :
13 |
14 | `docker run -d -p 8000:80 mySuperImageName`
15 |
16 | Then go to [YourDockerIP:8000]()
--------------------------------------------------------------------------------
/docker/baikal.conf:
--------------------------------------------------------------------------------
1 |
2 |
3 | DocumentRoot /var/www/baikal/web
4 |
5 |
6 | # enable the .htaccess rewrites
7 | AllowOverride All
8 | Order allow,deny
9 | Allow from All
10 |
11 |
12 | ErrorLog /var/log/apache2/baikal_error.log
13 | CustomLog /var/log/apache2/baikal_access.log combined
14 |
15 |
16 |
--------------------------------------------------------------------------------
/docker/docker-compose.yml:
--------------------------------------------------------------------------------
1 | baikal:
2 | build: .
3 | ports:
4 | - "8000:80"
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Baikal",
3 | "version": "2.0.0-alpha3",
4 | "description": "CalDAV + CardDAV server and web client",
5 | "scripts": {
6 | "test": "echo \"Error: no test specified\" && exit 1",
7 | "unpack": "bower install && npm install && grunt && cd web/apps/pulpy && npm install && cd ../buddies && npm install",
8 | "dev": "php app/console server:run 0.0.0.0:8000 --verbose --env=dev & cd web/apps/pulpy && grunt serve & cd web/apps/buddies && grunt serve & wait",
9 | "build": "php app/console cache:clear --env=prod && cd web/apps/pulpy && grunt build && cd ../buddies && grunt build && cd ../../.. && grunt",
10 | "prod": "npm start",
11 | "start": "php app/console server:run 0.0.0.0:8000 --verbose --env=prod"
12 | },
13 | "repository": {
14 | "type": "git",
15 | "url": "https://github.com/netgusto/Baikal.git"
16 | },
17 | "author": "Net Gusto / Jérôme Schneider",
18 | "license": "GNU GPL",
19 | "bugs": {
20 | "url": "https://github.com/netgusto/Baikal/issues"
21 | },
22 | "homepage": "https://github.com/netgusto/Baikal",
23 | "devDependencies": {
24 | "grunt": "^0.4.5",
25 | "grunt-bowercopy": "^1.2.0",
26 | "grunt-contrib-clean": "^0.6.0",
27 | "grunt-contrib-compress": "^0.13.0",
28 | "grunt-contrib-concat": "^0.5.1",
29 | "grunt-contrib-copy": "^0.8.0",
30 | "grunt-contrib-cssmin": "^0.12.2",
31 | "grunt-contrib-uglify": "^0.8.0",
32 | "grunt-contrib-watch": "^0.6.1"
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/scalingo.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Baikal",
3 | "repository": "https://github.com/netgusto/Baikal",
4 | "description": "Baïkal 2 is a Calendar+Contacts server + web client",
5 | "logo": "https://cdn.rawgit.com/netgusto/Baikal/branch-2/web/assets/images/baikal-logo.svg",
6 | "addons": ["scalingo-mysql"]
7 | }
8 |
--------------------------------------------------------------------------------
/src/.htaccess:
--------------------------------------------------------------------------------
1 |
2 | Require all denied
3 |
4 |
5 | Order deny,allow
6 | Deny from all
7 |
8 |
--------------------------------------------------------------------------------
/src/Baikal/AdminBundle/BaikalAdminBundle.php:
--------------------------------------------------------------------------------
1 | action($request, $user);
16 | }
17 |
18 | public function editAction(Request $request, User $user, Addressbook $addressbook) {
19 | if(!$this->get('security.context')->isGranted('dav.read', $addressbook)) {
20 | throw new HttpException(401, 'Unauthorized access.');
21 | }
22 |
23 | return $this->action($request, $user, $addressbook);
24 | }
25 |
26 | protected function action(Request $request, User $user, Addressbook $addressbook = null) {
27 | $that = $this;
28 |
29 | return $this->get('baikal.formhandler.addressbook')->handle(
30 | $this->getSuccessFunction($user),
31 | $this->getFailureFunction($user),
32 | $request,
33 | $user,
34 | $addressbook # if null, creation
35 | );
36 | }
37 |
38 | protected function getSuccessFunction(User $user) {
39 | $that = $this;
40 |
41 | return function($form, Addressbook $addressbook, $isNew) use($user, $that) {
42 | $that->get('session')->getFlashBag()->add('notice', 'Addressbook ' . htmlspecialchars($addressbook->getDisplayname()) . ' has been ' . ($isNew ? 'created' : 'updated') . '.');
43 | return $that->redirect($this->generateUrl('baikal_admin_user_addressbook_list', array('id' => $user->getId())));
44 | };
45 | }
46 |
47 | protected function getFailureFunction(User $user) {
48 | $that = $this;
49 |
50 | return function($form, Addressbook $addressbook, $isNew) use ($user, $that) {
51 | return $this->render('BaikalAdminBundle:Addressbook:form.html.twig', array(
52 | 'form' => $form->createView(),
53 | 'user' => $user,
54 | 'addressbook' => $addressbook
55 | ));
56 | };
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/src/Baikal/AdminBundle/Controller/Addressbook/ListController.php:
--------------------------------------------------------------------------------
1 | get('baikal.repository.addressbook')->findByUser($user);
15 |
16 | $that = $this;
17 |
18 | return $this->render('BaikalAdminBundle:Addressbook:list.html.twig', array(
19 | 'user' => $user,
20 | 'addressbooks' => $addressbooks,
21 | 'urls' => array(
22 | 'view' => function($user, $addressbook) use (&$that) {
23 | return $that->generateUrl('baikal_admin_addressbook_view', array('user' => $user->getId(), 'addressbook' => $addressbook->getId()));
24 | },
25 | 'edit' => function($user, $addressbook) use (&$that) {
26 | return $that->generateUrl('baikal_admin_addressbook_form_edit', array('user' => $user->getId(), 'addressbook' => $addressbook->getId()));
27 | },
28 | 'delete' => function($user, $addressbook) use (&$that) {
29 | return $that->generateUrl('baikal_admin_addressbook_list_delete', array('user' => $user->getId(), 'addressbook' => $addressbook->getId()));
30 | }
31 | ),
32 | ));
33 | }
34 |
35 | public function deleteAction(User $user, Addressbook $addressbook) {
36 |
37 | $em = $this->getDoctrine()->getManager();
38 | $em->remove($addressbook);
39 | $em->flush();
40 |
41 | $this->get('session')->getFlashBag()->add('notice', 'Addressbook ' . htmlspecialchars($addressbook->getDisplayname()) . ' has been deleted.');
42 | return $this->redirect($this->generateUrl('baikal_admin_user_addressbook_list', array('id' => $user->getId())));
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/src/Baikal/AdminBundle/Controller/Addressbook/ViewController.php:
--------------------------------------------------------------------------------
1 | render('BaikalAdminBundle:Addressbook:view.html.twig', array(
15 | 'user' => $user,
16 | 'addressbook' => $addressbook,
17 | ));
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/Baikal/AdminBundle/Controller/Application/FormController.php:
--------------------------------------------------------------------------------
1 | action($request);
14 | }
15 |
16 | public function editAction(Request $request, Application $application) {
17 | return $this->action($request, $application);
18 | }
19 |
20 | protected function action(Request $request, Application $application = null) {
21 | $that = $this;
22 |
23 | return $this->get('baikal.formhandler.application')->handle(
24 | $this->getSuccessFunction(),
25 | $this->getViewFunction(),
26 | $request,
27 | $application # if null, creation
28 | );
29 | }
30 |
31 | protected function getSuccessFunction() {
32 | $that = $this;
33 |
34 | return function($form, Application $application, $isNew) use($that) {
35 | $that->get('session')->getFlashBag()->add('notice', 'Application ' . htmlspecialchars($application->getName()) . ' has been ' . ($isNew ? 'created' : 'updated') . '.');
36 | return $that->redirect($this->generateUrl('baikal_admin_application_form_edit', array('application' => $application->getId())));
37 | };
38 | }
39 |
40 | protected function getViewFunction() {
41 | $that = $this;
42 |
43 | return function($form, Application $application, $isNew) use ($that) {
44 | $nbusers = $this->get('baikal.repository.oauthaccesstoken')->countForClient($application);
45 |
46 | return $this->render('BaikalAdminBundle:Application:form.html.twig', array(
47 | 'form' => $form->createView(),
48 | 'application' => $application,
49 | 'nbusers' => $nbusers
50 | ));
51 | };
52 | }
53 | }
--------------------------------------------------------------------------------
/src/Baikal/AdminBundle/Controller/Application/ListController.php:
--------------------------------------------------------------------------------
1 | get('baikal.repository.oauthclient')->findAll();
18 | return $this->render('BaikalAdminBundle:Application:list.html.twig', array(
19 | 'apps' => $apps,
20 | 'urls' => array(
21 | 'edit' => function(Application $application) use (&$that) {
22 | return $that->generateUrl('baikal_admin_application_form_edit', array('application' => $application->getId()));
23 | },
24 | 'delete' => function(Application $application) use (&$that) {
25 | return $that->generateUrl('baikal_admin_application_list_delete', array('application' => $application->getId()));
26 | }
27 | ),
28 | ));
29 | }
30 |
31 | public function deleteAction(Application $application) {
32 |
33 | $em = $this->getDoctrine()->getManager();
34 | $em->remove($application);
35 | $em->flush();
36 |
37 | $this->get('session')->getFlashBag()->add('notice', 'Application ' . htmlspecialchars($application->getName()) . ' has been deleted.');
38 | return $this->redirect($this->generateUrl('baikal_admin_application_list'));
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/Baikal/AdminBundle/Controller/AuthController.php:
--------------------------------------------------------------------------------
1 | get('security.context')->isGranted('IS_AUTHENTICATED_FULLY')) {
17 | throw new \Exception("Error Processing Request", 1);
18 | // redirect authenticated users to homepage
19 | return $this->redirect($this->generateUrl('baikal_admin_homepage'));
20 | }
21 |
22 | if($this->get('security.context')->isGranted('IS_AUTHENTICATED_REMEMBERED')) {
23 | throw new \Exception("Error Processing Request", 1);
24 | // redirect authenticated users to homepage
25 | return $this->redirect($this->generateUrl('baikal_admin_homepage'));
26 | }
27 |
28 | $request = $this->getRequest();
29 | $session = $request->getSession();
30 |
31 | // get the login error if there is one
32 | if ($request->attributes->has(SecurityContext::AUTHENTICATION_ERROR)) {
33 | $error = $request->attributes->get(SecurityContext::AUTHENTICATION_ERROR);
34 | } else {
35 | $error = $session->get(SecurityContext::AUTHENTICATION_ERROR);
36 | $session->remove(SecurityContext::AUTHENTICATION_ERROR);
37 | }
38 |
39 | return $this->render('BaikalAdminBundle:Auth:loginform.html.twig', array(
40 | // last username entered by the user
41 | 'last_username' => $session->get(SecurityContext::LAST_USERNAME),
42 | 'error' => $error,
43 | ));
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/src/Baikal/AdminBundle/Controller/Calendar/FormController.php:
--------------------------------------------------------------------------------
1 | action($request, $user);
17 | }
18 |
19 | public function editAction(Request $request, User $user, Calendar $calendar) {
20 | if(!$this->get('security.context')->isGranted('dav.read', $calendar)) {
21 | throw new HttpException(401, 'Unauthorized access.');
22 | }
23 |
24 | return $this->action($request, $user, $calendar);
25 | }
26 |
27 | protected function action(Request $request, User $user, Calendar $calendar = null) {
28 | $that = $this;
29 |
30 | return $this->get('baikal.formhandler.calendar')->handle(
31 | $this->getSuccessFunction($user),
32 | $this->getFailureFunction($user),
33 | $request,
34 | $user,
35 | $calendar # if null, creation
36 | );
37 | }
38 |
39 | protected function getSuccessFunction(User $user) {
40 | $that = $this;
41 |
42 | return function($form, Calendar $calendar, $isNew) use($user, $that) {
43 | $that->get('session')->getFlashBag()->add('notice', 'Calendar ' . htmlspecialchars($calendar->getDisplayname()) . ' has been ' . ($isNew ? 'created' : 'updated') . '.');
44 | return $that->redirect($this->generateUrl('baikal_admin_user_calendar_list', array('id' => $user->getId())));
45 | };
46 | }
47 |
48 | protected function getFailureFunction(User $user) {
49 | $that = $this;
50 |
51 | return function($form, Calendar $calendar, $isNew) use ($user, $that) {
52 | return $this->render('BaikalAdminBundle:Calendar:form.html.twig', array(
53 | 'form' => $form->createView(),
54 | 'user' => $user,
55 | 'calendar' => $calendar
56 | ));
57 | };
58 | }
59 | }
--------------------------------------------------------------------------------
/src/Baikal/AdminBundle/Controller/Calendar/InstructionsController.php:
--------------------------------------------------------------------------------
1 | get('security.context')->isGranted('dav.read', $calendar)) {
17 | throw new HttpException(401, 'Unauthorized access.');
18 | }
19 |
20 | return $this->render('BaikalAdminBundle:Calendar:instructions.html.twig', array(
21 | 'user' => $user,
22 | 'calendar' => $calendar,
23 | ));
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/Baikal/AdminBundle/Controller/Calendar/ListController.php:
--------------------------------------------------------------------------------
1 | get('baikal.repository.calendar')->findByUser($user);
15 |
16 | $that = $this;
17 |
18 | return $this->render('BaikalAdminBundle:Calendar:list.html.twig', array(
19 | 'user' => $user,
20 | 'calendars' => $calendars,
21 | 'urls' => array(
22 | 'view' => function($user, $calendar) use (&$that) {
23 | return $that->generateUrl('baikal_admin_calendar_view', array('user' => $user->getId(), 'calendar' => $calendar->getId()));
24 | },
25 | 'edit' => function($user, $calendar) use (&$that) {
26 | return $that->generateUrl('baikal_admin_calendar_form_edit', array('user' => $user->getId(), 'calendar' => $calendar->getId()));
27 | },
28 | 'delete' => function($user, $calendar) use (&$that) {
29 | return $that->generateUrl('baikal_admin_calendar_list_delete', array('user' => $user->getId(), 'calendar' => $calendar->getId()));
30 | },
31 | 'instructions' => function($user, $calendar) use (&$that) {
32 | return $that->generateUrl('baikal_admin_calendar_instructions', array('user' => $user->getId(), 'calendar' => $calendar->getId()));
33 | },
34 | )
35 | ));
36 | }
37 |
38 | public function deleteAction(User $user, Calendar $calendar) {
39 |
40 | $em = $this->getDoctrine()->getManager();
41 | $em->remove($calendar);
42 | $em->flush();
43 |
44 | $this->get('session')->getFlashBag()->add('notice', 'Calendar ' . htmlspecialchars($calendar->getDisplayname()) . ' has been deleted.');
45 | return $this->redirect($this->generateUrl('baikal_admin_user_calendar_list', array('id' => $user->getId())));
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/src/Baikal/AdminBundle/Controller/Calendar/ViewController.php:
--------------------------------------------------------------------------------
1 | get('security.context')->isGranted('dav.read', $calendar)) {
17 | throw new HttpException(401, 'Unauthorized access.');
18 | }
19 |
20 | return $this->render('BaikalAdminBundle:Calendar:view.html.twig', array(
21 | 'user' => $user,
22 | 'calendar' => $calendar,
23 | ));
24 | }
25 |
26 | public function fullscreenAction(Request $request, User $user, Calendar $calendar) {
27 |
28 | if(!$this->get('security.context')->isGranted('dav.read', $calendar)) {
29 | throw new HttpException(401, 'Unauthorized access.');
30 | }
31 |
32 | return $this->render('BaikalAdminBundle:Calendar:view.fullscreen.html.twig', array(
33 | 'user' => $user,
34 | 'calendar' => $calendar,
35 | ));
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/Baikal/AdminBundle/Controller/DashboardController.php:
--------------------------------------------------------------------------------
1 | getDoctrine()->getManager()->getRepository('\Baikal\SystemBundle\Entity\User')->countAll();
12 |
13 | $nbcalendars = $this->get('baikal.repository.calendar')->countAll();
14 | $nbevents = $this->get('baikal.repository.event')->countAll();
15 |
16 | $nbaddressbooks = $this->get('baikal.repository.addressbook')->countAll();
17 | $nbaddressbookcontacts = $this->getDoctrine()->getManager()->getRepository('\Baikal\ModelBundle\Entity\AddressbookContact')->countAll();
18 |
19 | return $this->render('BaikalAdminBundle:Dashboard:index.html.twig', array(
20 | 'nbusers' => $nbusers,
21 | 'nbcalendars' => $nbcalendars,
22 | 'nbevents' => $nbevents,
23 | 'nbaddressbooks' => $nbaddressbooks,
24 | 'nbaddressbookcontacts' => $nbaddressbookcontacts,
25 | ));
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/Baikal/AdminBundle/Controller/User/InfoController.php:
--------------------------------------------------------------------------------
1 | render('BaikalAdminBundle:User:info.html.twig', array(
16 | 'nbcalendars' => count($user->getCalendars()),
17 | 'nbbooks' => count($user->getAddressbooks()),
18 | 'user' => $user,
19 | ));
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/Baikal/AdminBundle/Controller/User/ListController.php:
--------------------------------------------------------------------------------
1 | getDoctrine()->getManager()->getRepository('\Baikal\SystemBundle\Entity\User')->findAll();
14 |
15 | return $this->render('BaikalAdminBundle:User:list.html.twig', array(
16 | 'users' => $users,
17 | ));
18 | }
19 |
20 | public function deleteAction(User $user)
21 | {
22 | $em = $this->getDoctrine()->getManager();
23 | $em->remove($user);
24 | $em->flush();
25 |
26 | $this->get('session')->getFlashBag()->add('notice', 'User ' . htmlspecialchars($user->getUsername()) . ' has been deleted.');
27 | return $this->redirect($this->generateUrl('baikal_admin_user_list'));
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/Baikal/AdminBundle/DependencyInjection/Configuration.php:
--------------------------------------------------------------------------------
1 | root('baikal_admin');
22 |
23 | // Here you should define the parameters that are allowed to
24 | // configure your bundle. See the documentation linked above for
25 | // more information on that topic.
26 |
27 | return $treeBuilder;
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/Baikal/AdminBundle/DependencyInjection/NetgustoBaikalAdminExtension.php:
--------------------------------------------------------------------------------
1 | processConfiguration($configuration, $configs);
24 |
25 | $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
26 | $loader->load('services.yml');
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/Baikal/AdminBundle/Menu/Builder.php:
--------------------------------------------------------------------------------
1 | createItem('root', array('childrenAttributes' => array('class' => 'nav navbar-nav')));
16 |
17 | $menu->addChild('Users+Data', array('route' => 'baikal_admin_user_list'));
18 | $menu->addChild('Applications', array('route' => 'baikal_admin_application_list'));
19 | $menu->addChild('Settings', array('route' => 'baikal_admin_settings'));
20 |
21 | $currentpath = $this->container->get('request')->getPathInfo();
22 |
23 | foreach($menu as $item) {
24 | $item->setCurrent((bool)preg_match('%^' . preg_quote($item->getUri()) . '%', $currentpath));
25 | }
26 |
27 | return $menu;
28 | }
29 | }
--------------------------------------------------------------------------------
/src/Baikal/AdminBundle/Resources/config/config.yml:
--------------------------------------------------------------------------------
1 | imports:
2 | # - { resource: assets.yml }
--------------------------------------------------------------------------------
/src/Baikal/AdminBundle/Resources/config/services.yml:
--------------------------------------------------------------------------------
1 | services:
2 | baikal_admin.access_denied_handler:
3 | class: Baikal\AdminBundle\Service\AccessDeniedHandler
4 | arguments: [@http_kernel, @security.context, @router]
5 | tags:
6 | - { name: kernel.event_listener, event: security.kernel_response, method: handle }
7 |
8 |
--------------------------------------------------------------------------------
/src/Baikal/AdminBundle/Resources/doc/index.rst:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sabre-io/Baikal2/b5142938b8e5dde693f31ff52e061f2d2810aee2/src/Baikal/AdminBundle/Resources/doc/index.rst
--------------------------------------------------------------------------------
/src/Baikal/AdminBundle/Resources/sources/less/style.less:
--------------------------------------------------------------------------------
1 | /* rien */
--------------------------------------------------------------------------------
/src/Baikal/AdminBundle/Resources/translations/messages.fr.xlf:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Symfony2 is great
7 | J'aime Symfony2
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/src/Baikal/AdminBundle/Resources/views/Addressbook/form.html.twig:
--------------------------------------------------------------------------------
1 | {% extends "BaikalAdminBundle:Layouts:standard.html.twig" %}
2 |
3 | {% block content %}
4 |
5 | {% set new = not (addressbook is defined and addressbook.id) %}
6 |
7 | {% embed "BaikalViewComponentsBundle:Components:pageheader.html.twig" %}
8 | {% set icon = "book" %}
9 | {% set header = 'Addressbook for ' ~ user.uiLabel() %}
10 | {% block header %}
11 | Users
12 |
13 |
14 |
15 | {% include "BaikalViewComponentsBundle:Components:avatar.textsize.html.twig" with { email: user.email } %} {{ user.uiLabel() }}
16 |
17 |
18 |
19 | Contact books
20 |
21 |
22 |
23 | {% if not new %}
24 | {{ addressbook.displayName() }}
25 |
26 |
27 |
28 | Edit
29 | {% else %}
30 | New
31 | {% endif %}
32 |
33 | {% endblock %}
34 | {% endembed %}
35 |
36 | {% embed "BaikalViewComponentsBundle:Components:Addressbook/form.html.twig" with {
37 | new: new,
38 | url_cancel: path('baikal_admin_user_addressbook_list', { id: user.id })
39 | } %}{% endembed %}
40 |
41 | {% endblock %}
--------------------------------------------------------------------------------
/src/Baikal/AdminBundle/Resources/views/Addressbook/list.html.twig:
--------------------------------------------------------------------------------
1 | {% extends "BaikalAdminBundle:Layouts:standard.html.twig" %}
2 |
3 | {% set pagetitle = "Addressbooks for " ~ user.getUsername() %}
4 |
5 | {% block content %}
6 |
7 | {% embed "BaikalViewComponentsBundle:Components:pageheader.html.twig" %}
8 | {% set icon = "group" %}
9 | {% block header %}
10 | Users
11 |
12 |
13 |
14 | {% include "BaikalViewComponentsBundle:Components:avatar.textsize.html.twig" with { email: user.email } %} {{ user.uiLabel() }}
15 |
16 |
17 |
18 | Contact books
19 | {% endblock %}
20 | {% endembed %}
21 |
22 | {% if addressbooks|length %}
23 | {% embed "BaikalViewComponentsBundle:Components:addbutton.html.twig" %}
24 | {% set button_url = path('baikal_admin_addressbook_form_new', { 'user': user.id }) %}
25 | {% set button_text = ' Add book' %}
26 | {% endembed %}
27 |
28 | {% embed "BaikalViewComponentsBundle:Components:Addressbook/list.html.twig" with {
29 | 'items': addressbooks,
30 | 'user': user
31 | } %}{% endembed %}
32 | {% else %}
33 | {% embed "BaikalViewComponentsBundle:Components:nothinghere.html.twig" with {
34 | itemname: 'addressbook',
35 | actionurl: path('baikal_admin_addressbook_form_new', { user: user.id }),
36 | calltoaction: 'Create one now'
37 | } %}{% endembed %}
38 | {% endif %}
39 |
40 | {% endblock %}
41 |
42 | {% block scripts %}
43 | {% embed "BaikalViewComponentsBundle:Components:list.scripts.html.twig" %}{% endembed %}
44 | {% endblock %}
--------------------------------------------------------------------------------
/src/Baikal/AdminBundle/Resources/views/Addressbook/view.html.twig:
--------------------------------------------------------------------------------
1 | {% extends "BaikalAdminBundle:Layouts:standard.html.twig" %}
2 |
3 | {% set pagetitle = "Addressbook " ~ addressbook.getDisplayname() ~ " of " ~ user.uiLabel() %}
4 |
5 | {% block content %}
6 |
7 | {% embed "BaikalViewComponentsBundle:Components:pageheader.html.twig" %}
8 | {% set icon = "group" %}
9 | {% block header %}
10 | Users
11 |
12 |
13 |
14 | {% include "BaikalViewComponentsBundle:Components:avatar.textsize.html.twig" with { email: user.email } %} {{ user.uiLabel() }}
15 |
16 |
17 |
18 | Contact books
19 |
20 |
21 |
22 | {{ addressbook.getDisplayname() }}
23 | {% endblock %}
24 | {% endembed %}
25 |
26 | {% embed "BaikalViewComponentsBundle:Components:SPA/cardclient.html.twig" with {
27 | addressbook: addressbook,
28 | user: user
29 | } %}{% endembed %}
30 |
31 | {% endblock %}
--------------------------------------------------------------------------------
/src/Baikal/AdminBundle/Resources/views/Application/list.html.twig:
--------------------------------------------------------------------------------
1 | {% extends "BaikalAdminBundle:Layouts:standard.html.twig" %}
2 |
3 | {% set pagetitle = "Registered applications" %}
4 |
5 | {% block content %}
6 |
7 | {% embed "BaikalViewComponentsBundle:Components:pageheader.html.twig" %}
8 | {% set icon = "cubes" %}
9 | {% block header %}Applications (OAuth){% endblock %}
10 | {% endembed %}
11 |
12 | {% if apps|length %}
13 |
14 | {% embed "BaikalViewComponentsBundle:Components:addbutton.html.twig" %}
15 | {% set button_url = path('baikal_admin_application_form_new') %}
16 | {% set button_text = ' Add Application' %}
17 | {% endembed %}
18 |
19 | {% embed "BaikalViewComponentsBundle:Components:list.html.twig" with { items: apps } %}
20 | {% block payload %}
21 |
22 |
23 | {{ item.name }}
24 |
25 | {{ item.description }}
26 |
27 | {% endblock %}
28 | {% block actions %}
29 |
30 |
38 |
39 | {% endblock %}
40 | {% block deletemodal %}
41 | {% embed "BaikalViewComponentsBundle:Components:modal.html.twig" %}
42 |
43 | {% block title %}Delete application Application name{% endblock %}
44 | {% block body %}
45 | You are about to delete Application name and all it's data.
46 | Careful ! This operation is destructive, and cannot be undone.
47 | {% endblock %}
48 |
49 | {% endembed %}
50 | {% endblock %}
51 | {% endembed %}
52 |
53 | {% else %}
54 | {% embed "BaikalViewComponentsBundle:Components:nothinghere.html.twig" with {
55 | itemname: 'application',
56 | actionurl: path('baikal_admin_application_form_new'),
57 | calltoaction: 'Create one now'
58 | } %}{% endembed %}
59 | {% endif %}
60 |
61 | {% endblock %}
--------------------------------------------------------------------------------
/src/Baikal/AdminBundle/Resources/views/Auth/loginform.html.twig:
--------------------------------------------------------------------------------
1 | {% extends "BaikalAdminBundle:Layouts:standard.html.twig" %}
2 |
3 | {% set pagetitle = "Auth" %}
4 |
5 | {% block content %}
6 |
7 | {% embed "BaikalViewComponentsBundle:Components:loginform.html.twig" with {
8 | logincheckurl: path('baikal_admin_login_check'),
9 | redirecturl: path('baikal_admin_homepage')
10 | } %}{% endembed %}
11 | {% endblock %}
--------------------------------------------------------------------------------
/src/Baikal/AdminBundle/Resources/views/Calendar/form.html.twig:
--------------------------------------------------------------------------------
1 | {% extends "BaikalAdminBundle:Layouts:standard.html.twig" %}
2 |
3 | {% block content %}
4 |
5 | {% set new = not (calendar is defined and calendar.id) %}
6 |
7 | {% embed "BaikalViewComponentsBundle:Components:pageheader.html.twig" %}
8 | {% set icon = "group" %}
9 | {% block header %}
10 | Users
11 |
12 |
13 |
14 | {% include "BaikalViewComponentsBundle:Components:avatar.textsize.html.twig" with { email: user.email } %} {{ user.uiLabel() }}
15 |
16 |
17 |
18 | Calendars
19 |
20 |
21 |
22 | {% if new %}
23 | New calendar
24 | {% else %}
25 | Editing {% include "BaikalViewComponentsBundle:Components:calendarpill.html.twig" with { calendar: calendar } %} {{ calendar.displayName() }}
26 | {% endif %}
27 |
28 | {% endblock %}
29 | {% endembed %}
30 |
31 | {% embed "BaikalViewComponentsBundle:Components:Calendar/form.html.twig" with {
32 | new: new,
33 | url_cancel: path('baikal_admin_user_calendar_list', { 'id' : user.id })
34 | } %}{% endembed %}
35 |
36 | {% endblock %}
37 |
38 | {% block scripts %}
39 | {% embed "BaikalViewComponentsBundle:Components:Calendar/form.scripts.html.twig" %}{% endembed %}
40 | {% endblock %}
--------------------------------------------------------------------------------
/src/Baikal/AdminBundle/Resources/views/Calendar/instructions.html.twig:
--------------------------------------------------------------------------------
1 | {% extends "BaikalAdminBundle:Layouts:standard.html.twig" %}
2 |
3 | {% set pagetitle = "Calendar " ~ calendar.getDisplayname() ~ " of " ~ user.uiLabel() %}
4 |
5 | {% block content %}
6 |
7 | {% embed "BaikalViewComponentsBundle:Components:pageheader.html.twig" %}
8 | {% set icon = "group" %}
9 | {% block header %}
10 | Users
11 |
12 |
13 |
14 | {% include "BaikalViewComponentsBundle:Components:avatar.textsize.html.twig" with { email: user.email } %} {{ user.uiLabel() }}
15 |
16 |
17 |
18 | Calendars
19 |
20 |
21 |
22 | {% include "BaikalViewComponentsBundle:Components:calendarpill.html.twig" with { calendar: calendar } %} {{ calendar.getDisplayname() }}
23 |
24 |
25 |
26 | Connect
27 |
28 | {% endblock %}
29 | {% endembed %}
30 |
31 | {% embed "BaikalViewComponentsBundle:Components:Calendar/instructions.html.twig" with {
32 | user: user,
33 | calendar: calendar
34 | } %}{% endembed %}
35 |
36 | {% endblock %}
--------------------------------------------------------------------------------
/src/Baikal/AdminBundle/Resources/views/Calendar/list.html.twig:
--------------------------------------------------------------------------------
1 | {% extends "BaikalAdminBundle:Layouts:standard.html.twig" %}
2 |
3 | {% set pagetitle = "Calendars for " ~ user.uiLabel() %}
4 |
5 | {% block content %}
6 |
7 | {% embed "BaikalViewComponentsBundle:Components:pageheader.html.twig" %}
8 | {% set icon = "group" %}
9 | {% block header %}
10 | Users
11 |
12 |
13 |
14 | {% include "BaikalViewComponentsBundle:Components:avatar.textsize.html.twig" with { email: user.email } %} {{ user.uiLabel() }}
15 |
16 |
17 |
18 | Calendars
19 | {% endblock %}
20 | {% endembed %}
21 |
22 | {% if calendars|length %}
23 | {% embed "BaikalViewComponentsBundle:Components:addbutton.html.twig" %}
24 | {% set button_url = path('baikal_admin_calendar_form_new', { 'user': user.id }) %}
25 | {% set button_text = ' Add calendar' %}
26 | {% endembed %}
27 |
28 | {% embed "BaikalViewComponentsBundle:Components:Calendar/list.html.twig" with {
29 | 'user' : user,
30 | 'items' : calendars,
31 | 'urls': urls
32 | } %}{% endembed %}
33 | {% else %}
34 | {% embed "BaikalViewComponentsBundle:Components:nothinghere.html.twig" with {
35 | itemname: 'calendar',
36 | actionurl: path('baikal_admin_calendar_form_new', { user: user.id }),
37 | calltoaction: 'Create one now'
38 | } %}{% endembed %}
39 | {% endif %}
40 |
41 | {% endblock %}
42 |
43 | {% block scripts %}
44 | {% embed "BaikalViewComponentsBundle:Components:list.scripts.html.twig" %}{% endembed %}
45 | {% endblock %}
--------------------------------------------------------------------------------
/src/Baikal/AdminBundle/Resources/views/Calendar/view.html.twig:
--------------------------------------------------------------------------------
1 | {% extends "BaikalAdminBundle:Layouts:fullscreen.html.twig" %}
2 |
3 | {% set pagetitle = "Calendar " ~ calendar.getDisplayname() ~ " of " ~ user.uiLabel() %}
4 |
5 | {% block bodyclass %}calendar-fullscreen{% endblock %}
6 |
7 | {% set calview = application('pulpy', {
8 | rootElement: '#app-calclient',
9 | parameters: {
10 | apiendpoint: '/webapi/v1',
11 | calendarsEnabledAtStart: [calendar.getId()],
12 | calendarFocusedAtStart: calendar.getId(),
13 | starttime: 0,
14 | endtime: 23,
15 | businessstarttime: 7,
16 | businessendtime: 20,
17 | hourbarwidth: 30,
18 | hourheight: 60,
19 | allowMovingToAdjacentWeeks: true,
20 | windowed: true,
21 | cosmetic: {
22 | gutterwidth: 16,
23 | event: {
24 | marginLeft: 2,
25 | marginTop: 2,
26 | marginBottom: 3
27 | },
28 | popup: {
29 | width: 300,
30 | height: 200
31 | }
32 | }
33 | }
34 | }) %}
35 |
36 | {% block content %}
37 |
38 | {{ calview.html|raw }}
39 | {% endblock %}
40 |
41 | {% block scripts %}
42 | {{ calview.assets|raw }}
43 | {% endblock %}
--------------------------------------------------------------------------------
/src/Baikal/AdminBundle/Resources/views/Layouts/partials/_footer.html.twig:
--------------------------------------------------------------------------------
1 | {% extends "BaikalFrontendBundle:Layouts:partials/_footer.html.twig" %}
--------------------------------------------------------------------------------
/src/Baikal/AdminBundle/Resources/views/Layouts/standard.html.twig:
--------------------------------------------------------------------------------
1 | {% extends "BaikalViewComponentsBundle:Layouts:standard.html.twig" %}
2 |
3 | {% block body %}
4 |
5 | {% include 'BaikalAdminBundle:Layouts:partials/_header.html.twig' %}
6 |
7 | {% block content %}
8 | Content here
9 | {% endblock %}
10 |
11 | {% include 'BaikalAdminBundle:Layouts:partials/_footer.html.twig' %}
12 |
13 | {% endblock body %}
--------------------------------------------------------------------------------
/src/Baikal/AdminBundle/Resources/views/Settings/index.html.twig:
--------------------------------------------------------------------------------
1 | {% extends "BaikalAdminBundle:Layouts:standard.html.twig" %}
2 |
3 | {% set pagetitle = "Settings" %}
4 |
5 | {% block content %}
6 |
7 | {% embed "BaikalViewComponentsBundle:Components:pageheader.html.twig" %}
8 | {% set icon = "cogs" %}
9 | {% set header = "Settings" %}
10 | {% endembed %}
11 |
12 |
13 |
14 | {% include "BaikalViewComponentsBundle:Components:flash.notice.html.twig" %}
15 |
16 |
40 |
41 | {% endblock %}
--------------------------------------------------------------------------------
/src/Baikal/AdminBundle/Resources/views/User/form.html.twig:
--------------------------------------------------------------------------------
1 | {% extends "BaikalAdminBundle:Layouts:standard.html.twig" %}
2 |
3 | {% if user is defined %}
4 | {% set pagetitle = "Editing user '" ~ user.uiLabel() ~ "'" %}
5 | {% else %}
6 | {% set pagetitle = "New user" %}
7 | {% endif %}
8 |
9 | {% block content %}
10 |
11 |
12 | {% embed "BaikalViewComponentsBundle:Components:pageheader.html.twig" %}
13 | {% set icon = "group" %}
14 |
15 | {% block header %}
16 |
17 | Users
18 |
19 |
20 |
21 | {% if user is defined %}
22 | {% include "BaikalViewComponentsBundle:Components:avatar.textsize.html.twig" with { email: user.email } %} {{ user.uiLabel() }}
23 |
24 |
25 |
26 | Edit
27 | {% else %}
28 | New user
29 | {% endif %}
30 |
31 | {% endblock header %}
32 | {% endembed %}
33 |
34 |
73 |
74 | {% endblock %}
--------------------------------------------------------------------------------
/src/Baikal/AdminBundle/Resources/views/User/info.html.twig:
--------------------------------------------------------------------------------
1 | {% extends "BaikalAdminBundle:Layouts:standard.html.twig" %}
2 |
3 | {% set pagetitle = "Users" %}
4 |
5 | {% block content %}
6 |
7 | {% embed "BaikalViewComponentsBundle:Components:pageheader.html.twig" %}
8 | {% set icon = "group" %}
9 |
10 | {% block header %}
11 |
12 | Users
13 |
14 |
15 |
16 | {% include "BaikalViewComponentsBundle:Components:avatar.textsize.html.twig" with { email: user.email } %} {{ user.uiLabel() }}
17 |
18 | {% endblock header %}
19 | {% endembed %}
20 |
21 |
22 |
23 | {% include "BaikalViewComponentsBundle:Components:flash.notice.html.twig" %}
24 |
25 |
{{user.uiLabel()}}
26 |
27 |
{{nbcalendars}} {{ accord('calendar', nbcalendars)}}
28 |
29 |
{{nbbooks}} {{ accord('contact book', nbbooks)}}
30 |
31 |
32 |
33 | {% endblock %}
--------------------------------------------------------------------------------
/src/Baikal/AdminBundle/Resources/views/User/list.html.twig:
--------------------------------------------------------------------------------
1 | {% extends "BaikalAdminBundle:Layouts:standard.html.twig" %}
2 |
3 | {% set pagetitle = "Users" %}
4 |
5 | {% block content %}
6 |
7 | {% embed "BaikalViewComponentsBundle:Components:pageheader.html.twig" %}
8 | {% set icon = "group" %}
9 | {% set header = "Users" %}
10 | {% endembed %}
11 |
12 | {% embed "BaikalViewComponentsBundle:Components:addbutton.html.twig" %}
13 | {% set button_url = path('baikal_admin_user_form_new') %}
14 | {% set button_text = ' Add user' %}
15 | {% endembed %}
16 |
17 | {% embed "BaikalViewComponentsBundle:Components:User/list.html.twig" with {
18 | 'items' : users
19 | } %}{% endembed %}
20 |
21 | {% endblock %}
--------------------------------------------------------------------------------
/src/Baikal/AdminBundle/Service/AccessDeniedHandler.php:
--------------------------------------------------------------------------------
1 | kernel = $http_kernel;
24 | $this->securityContext = $securityContext;
25 | $this->router = $router;
26 | }
27 |
28 | /**
29 | * Handles an access denied failure.
30 | *
31 | * @param Request $request
32 | * @param AccessDeniedException $accessDeniedException
33 | *
34 | * @return Response may return null
35 | */
36 | public function handle(Request $request, AccessDeniedException $accessDeniedException) {
37 |
38 | # First we check if user has an access granted to the frontend
39 | if($this->securityContext->isGranted('ROLE_FRONTEND_USER')) {
40 | return new RedirectResponse($this->router->generate('baikal_frontend_homepage'));
41 | }
42 |
43 | # If not, we display an "Access denied" message
44 | $attributes = array(
45 | '_controller' => 'BaikalCoreBundle:Security:accessDenied',
46 | 'exception' => $accessDeniedException,
47 | );
48 |
49 | $subRequest = $request->duplicate(array(), null, $attributes);
50 | return $this->kernel->handle($subRequest, HttpKernelInterface::SUB_REQUEST);
51 | }
52 | }
--------------------------------------------------------------------------------
/src/Baikal/BootCampBundle/BaikalBootCampBundle.php:
--------------------------------------------------------------------------------
1 | processConfiguration($configuration, $configs);
24 |
25 | $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
26 | $loader->load('services.yml');
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/Baikal/BootCampBundle/DependencyInjection/Configuration.php:
--------------------------------------------------------------------------------
1 | root('baikal_boot_camp');
22 |
23 | // Here you should define the parameters that are allowed to
24 | // configure your bundle. See the documentation linked above for
25 | // more information on that topic.
26 |
27 | return $treeBuilder;
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/Baikal/BootCampBundle/InitHandler/ConfigInitHandler.php:
--------------------------------------------------------------------------------
1 | entityManager = $entityManager;
18 | }
19 |
20 | public function createAndPersistConfig() {
21 |
22 | $siteconfig = new ConfigContainer();
23 | $siteconfig->setName('main');
24 | $siteconfig->setConfig(array(
25 | 'server_timezone' => 'Europe/Paris',
26 | 'enable_caldav' => true,
27 | 'enable_carddav' => true,
28 | 'enable_versioncheck' => true,
29 | ));
30 |
31 | $this->entityManager->persist($siteconfig);
32 | $this->entityManager->flush();
33 | }
34 | }
--------------------------------------------------------------------------------
/src/Baikal/BootCampBundle/InitHandler/UserInitHandler.php:
--------------------------------------------------------------------------------
1 | entityManager = $entityManager;
22 | $this->passwordencoder = $passwordencoder;
23 | }
24 |
25 | public function createAndPersistUser($username, $password) {
26 |
27 | # Persisting identity principal
28 | $principalidentity = new UserPrincipal();
29 | $principalidentity->setDisplayname(ucwords($username));
30 | $principalidentity->setUri('principals/' . $username);
31 | $principalidentity->setEmail('admin@example.com');
32 |
33 | $this->entityManager->persist($principalidentity);
34 |
35 | # Persisting user
36 | $user = new User();
37 | $user->setUsername($username); # Not setting salt; handled by the user entity
38 | $user->setPassword(
39 | $this->passwordencoder->encodePassword(
40 | $password,
41 | $user->getSalt()
42 | )
43 | );
44 |
45 | $user->addRole('ROLE_ADMIN');
46 | $user->addRole('ROLE_FRONTEND_USER');
47 |
48 | $this->entityManager->persist($user);
49 | $this->entityManager->flush();
50 |
51 | return $user;
52 | }
53 | }
--------------------------------------------------------------------------------
/src/Baikal/BootCampBundle/Resources/config/services.yml:
--------------------------------------------------------------------------------
1 | # These services will be available only during composer install
2 |
3 | imports:
4 | - { resource: ../../../../../app/config/parameters.yml }
5 |
6 | services:
7 |
8 | baikal.bootcamp.userinithandler:
9 | class: Baikal\BootCampBundle\InitHandler\UserInitHandler
10 | arguments:
11 | - @doctrine.orm.entity_manager
12 | - @baikal.model.sabredav_password_encoder
13 |
14 | baikal.bootcamp.configinithandler:
15 | class: Baikal\BootCampBundle\InitHandler\ConfigInitHandler
16 | arguments:
17 | - @doctrine.orm.entity_manager
--------------------------------------------------------------------------------
/src/Baikal/FrontendBundle/BaikalFrontendBundle.php:
--------------------------------------------------------------------------------
1 | action($request);
16 | }
17 |
18 | public function editAction(Request $request, Addressbook $addressbook) {
19 | if(!$this->get('security.context')->isGranted('dav.read', $addressbook)) {
20 | throw new HttpException(401, 'Unauthorized access.');
21 | }
22 |
23 | return $this->action($request, $addressbook);
24 | }
25 |
26 | protected function action(Request $request, Addressbook $addressbook = null) {
27 | $that = $this;
28 | $user = $this->get('security.context')->getToken()->getUser();
29 |
30 | return $this->get('baikal.formhandler.addressbook')->handle(
31 | $this->getSuccessFunction($user),
32 | $this->getFailureFunction($user),
33 | $request,
34 | $user,
35 | $addressbook # if null, creation
36 | );
37 | }
38 |
39 | protected function getSuccessFunction(User $user) {
40 | $that = $this;
41 |
42 | return function($form, Addressbook $addressbook, $isNew) use($user, $that) {
43 | $that->get('session')->getFlashBag()->add('notice', 'Addressbook ' . htmlspecialchars($addressbook->getDisplayname()) . ' has been ' . ($isNew ? 'created' : 'updated') . '.');
44 | return $that->redirect($that->generateUrl('baikal_frontend_addressbook_list'));
45 | };
46 | }
47 |
48 | protected function getFailureFunction(User $user) {
49 | $that = $this;
50 |
51 | return function($form, Addressbook $addressbook, $isNew) use ($user, $that) {
52 | return $this->render('BaikalFrontendBundle:Addressbook:form.html.twig', array(
53 | 'form' => $form->createView(),
54 | 'user' => $user,
55 | 'addressbook' => $addressbook
56 | ));
57 | };
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/src/Baikal/FrontendBundle/Controller/Addressbook/ListController.php:
--------------------------------------------------------------------------------
1 | get('security.context')->getToken()->getUser();
13 | $books = $this->get('baikal.repository.addressbook')->findByUser($user);
14 |
15 | $that = $this;
16 |
17 | return $this->render('BaikalFrontendBundle:Addressbook:list.html.twig', array(
18 | 'user' => $user,
19 | 'addressbooks' => $books,
20 | 'urls' => array(
21 | 'view' => function($user, $addressbook) use (&$that) {
22 | return $that->generateUrl('baikal_frontend_addressbook_view', array('addressbook' => $addressbook->getId()));
23 | },
24 | 'edit' => function($user, $addressbook) use (&$that) {
25 | return $that->generateUrl('baikal_frontend_addressbook_form_edit', array('addressbook' => $addressbook->getId()));
26 | },
27 | 'delete' => function($user, $addressbook) use (&$that) {
28 | return $that->generateUrl('baikal_frontend_addressbook_list_delete', array('addressbook' => $addressbook->getId()));
29 | }
30 | ),
31 | ));
32 | }
33 |
34 | public function deleteAction(Entity\Addressbook $addressbook) {
35 |
36 | $em = $this->getDoctrine()->getManager();
37 | $em->remove($addressbook);
38 | $em->flush();
39 |
40 | $this->get('session')->getFlashBag()->add('notice', 'Addressbook ' . htmlspecialchars($addressbook->getDisplayname()) . ' has been deleted.');
41 | return $this->redirect($this->generateUrl('baikal_frontend_addressbook_list'));
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/Baikal/FrontendBundle/Controller/Addressbook/ViewController.php:
--------------------------------------------------------------------------------
1 | get('security.context')->isGranted('dav.read', $addressbook)) {
17 | throw new HttpException(401, 'Unauthorized access.');
18 | }
19 |
20 | $user = $this->get('security.context')->getToken()->getUser();
21 | return $this->render('BaikalFrontendBundle:Addressbook:view.html.twig', array(
22 | 'user' => $user,
23 | 'addressbook' => $addressbook,
24 | ));
25 | }
26 | }
--------------------------------------------------------------------------------
/src/Baikal/FrontendBundle/Controller/AuthController.php:
--------------------------------------------------------------------------------
1 | authenticate(
15 | $request,
16 | 'BaikalFrontendBundle:Auth:loginform.html.twig'
17 | );
18 | }
19 |
20 | public function oauthloginformAction(Request $request) {
21 | return $this->authenticate(
22 | $request,
23 | 'BaikalFrontendBundle:Auth:oauthloginform.html.twig'
24 | );
25 | }
26 |
27 | protected function authenticate(Request $request, $templatepath) {
28 |
29 | if($this->get('security.context')->isGranted('IS_AUTHENTICATED_FULLY')) {
30 | throw new \Exception("Error Processing Request", 1);
31 | }
32 |
33 | if($this->get('security.context')->isGranted('IS_AUTHENTICATED_REMEMBERED')) {
34 | throw new \Exception("Error Processing Request", 1);
35 | }
36 |
37 | $session = $request->getSession();
38 |
39 | # get the login error if there is one
40 | if ($request->attributes->has(SecurityContext::AUTHENTICATION_ERROR)) {
41 | $error = $request->attributes->get(SecurityContext::AUTHENTICATION_ERROR);
42 | } else {
43 | $error = $session->get(SecurityContext::AUTHENTICATION_ERROR);
44 | $session->remove(SecurityContext::AUTHENTICATION_ERROR);
45 | }
46 |
47 | return $this->render($templatepath, array(
48 | 'last_username' => $session->get(SecurityContext::LAST_USERNAME), # last username entered by the user
49 | 'error' => $error,
50 | ));
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/src/Baikal/FrontendBundle/Controller/Calendar/FormController.php:
--------------------------------------------------------------------------------
1 | action($request);
16 | }
17 |
18 | public function editAction(Request $request, Calendar $calendar) {
19 | if(!$this->get('security.context')->isGranted('dav.read', $calendar)) {
20 | throw new HttpException(401, 'Unauthorized access.');
21 | }
22 |
23 | return $this->action($request, $calendar);
24 | }
25 |
26 | protected function action(Request $request, Calendar $calendar = null) {
27 | $that = $this;
28 | $user = $this->get('security.context')->getToken()->getUser();
29 |
30 | return $this->get('baikal.formhandler.calendar')->handle(
31 | $this->getSuccessFunction($user),
32 | $this->getFailureFunction($user),
33 | $request,
34 | $user,
35 | $calendar # if null, creation
36 | );
37 | }
38 |
39 | protected function getSuccessFunction(User $user) {
40 | $that = $this;
41 |
42 | return function($form, Calendar $calendar, $isNew) use($user, $that) {
43 | $that->get('session')->getFlashBag()->add('notice', 'Calendar ' . htmlspecialchars($calendar->getDisplayname()) . ' has been ' . ($isNew ? 'created' : 'updated') . '.');
44 | return $that->redirect($that->generateUrl('baikal_frontend_calendar_list'));
45 | };
46 | }
47 |
48 | protected function getFailureFunction(User $user) {
49 | $that = $this;
50 |
51 | return function($form, Calendar $calendar, $isNew) use ($user, $that) {
52 | return $this->render('BaikalFrontendBundle:Calendar:form.html.twig', array(
53 | 'form' => $form->createView(),
54 | 'user' => $user,
55 | 'calendar' => $calendar
56 | ));
57 | };
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/src/Baikal/FrontendBundle/Controller/Calendar/InstructionsController.php:
--------------------------------------------------------------------------------
1 | get('security.context')->isGranted('dav.read', $calendar)) {
17 | throw new HttpException(401, 'Unauthorized access.');
18 | }
19 |
20 | $user = $this->get('security.context')->getToken()->getUser();
21 |
22 | return $this->render('BaikalFrontendBundle:Calendar:instructions.html.twig', array(
23 | 'user' => $user,
24 | 'calendar' => $calendar,
25 | ));
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/Baikal/FrontendBundle/Controller/Calendar/ListController.php:
--------------------------------------------------------------------------------
1 | get('security.context')->getToken()->getUser();
15 | $calendars = $this->get('baikal.repository.calendar')->findByUser($user);
16 |
17 | return $this->render('BaikalFrontendBundle:Calendar:list.html.twig', array(
18 | 'user' => $user,
19 | 'calendars' => $calendars,
20 | 'urls' => array(
21 | 'view' => function($user, $calendar) use (&$that) {
22 | return $that->generateUrl('baikal_frontend_calendar_view', array('calendar' => $calendar->getId()));
23 | },
24 | 'edit' => function($user, $calendar) use (&$that) {
25 | return $that->generateUrl('baikal_frontend_calendar_form_edit', array('calendar' => $calendar->getId()));
26 | },
27 | 'delete' => function($user, $calendar) use (&$that) {
28 | return $that->generateUrl('baikal_frontend_calendar_list_delete', array('calendar' => $calendar->getId()));
29 | },
30 | 'instructions' => function($user, $calendar) use (&$that) {
31 | return $that->generateUrl('baikal_frontend_calendar_instructions', array('calendar' => $calendar->getId()));
32 | },
33 | )
34 | ));
35 | }
36 |
37 | public function deleteAction(Calendar $calendar) {
38 |
39 | $em = $this->getDoctrine()->getManager();
40 | $em->remove($calendar);
41 | $em->flush();
42 |
43 | $this->get('session')->getFlashBag()->add('notice', 'Calendar ' . htmlspecialchars($calendar->getDisplayname()) . ' has been deleted.');
44 | return $this->redirect($this->generateUrl('baikal_frontend_calendar_list'));
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/src/Baikal/FrontendBundle/Controller/Calendar/ViewController.php:
--------------------------------------------------------------------------------
1 | get('security.context')->isGranted('dav.read', $calendar)) {
17 | throw new HttpException(401, 'Unauthorized access.');
18 | }
19 |
20 | $user = $this->get('security.context')->getToken()->getUser();
21 |
22 | return $this->render('BaikalFrontendBundle:Calendar:view.html.twig', array(
23 | 'user' => $user,
24 | 'calendar' => $calendar,
25 | ));
26 | }
27 |
28 | public function fullscreenAction(Request $request, Calendar $calendar) {
29 | $user = $this->get('security.context')->getToken()->getUser();
30 | return $this->render('BaikalFrontendBundle:Calendar:view.fullscreen.html.twig', array(
31 | 'user' => $user,
32 | 'calendar' => $calendar,
33 | ));
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/Baikal/FrontendBundle/Controller/DashboardController.php:
--------------------------------------------------------------------------------
1 | render('BaikalFrontendBundle:Dashboard:index.html.twig', array(
13 | 'user' => $this->get('security.context')->getToken()->getUser(),
14 | ));
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/Baikal/FrontendBundle/Controller/ProfileController.php:
--------------------------------------------------------------------------------
1 | get('security.context')->getToken()->getUser();
16 | $principalidentity = $user->getIdentityPrincipal();
17 |
18 | $data = array(
19 | 'displayname' => $principalidentity->getDisplayname(),
20 | 'email' => $principalidentity->getEmail(),
21 | 'roles' => $user->getRoles(),
22 | );
23 |
24 | $form = $this->get('form.factory')->create(new FormType\User\EditUserType());
25 |
26 | $form->setData($data);
27 | $form->handleRequest($request);
28 |
29 | if($form->isValid()) {
30 | $data = $form->getData();
31 | $em = $this->getDoctrine()->getManager();
32 |
33 | # Persisting identity principal
34 | $principalidentity->setDisplayname($data['displayname']);
35 | $principalidentity->setEmail($data['email']);
36 |
37 | $em->persist($principalidentity);
38 |
39 | # Persisting user if password changed
40 | if(!is_null($data['password'])) {
41 | $password = $data['password'];
42 |
43 | $user->setPassword(
44 | $this->get('security.encoder_factory')
45 | ->getEncoder($user)
46 | ->encodePassword(
47 | $password,
48 | $user->getSalt()
49 | )
50 | );
51 | }
52 |
53 | # Persisting user roles
54 | $user->setRoles($data['roles']);
55 |
56 | $em->persist($user);
57 | $em->flush();
58 |
59 | $this->get('session')->getFlashBag()->add('notice', 'User ' . htmlspecialchars($user->getUsername()) . ' has been updated.');
60 | return $this->redirect($this->generateUrl('baikal_admin_user_list'));
61 | }
62 |
63 | return $this->render('BaikalFrontendBundle:Profile:index.html.twig', array(
64 | 'user' => $user,
65 | 'form' => $form->createView(),
66 | ));
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/src/Baikal/FrontendBundle/DependencyInjection/Configuration.php:
--------------------------------------------------------------------------------
1 | root('baikal_frontend');
22 |
23 | // Here you should define the parameters that are allowed to
24 | // configure your bundle. See the documentation linked above for
25 | // more information on that topic.
26 |
27 | return $treeBuilder;
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/Baikal/FrontendBundle/DependencyInjection/NetgustoBaikalFrontendExtension.php:
--------------------------------------------------------------------------------
1 | processConfiguration($configuration, $configs);
24 |
25 | $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
26 | $loader->load('services.yml');
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/Baikal/FrontendBundle/Form/Type/Calendar/CalendarType.php:
--------------------------------------------------------------------------------
1 | remove('roles');
14 | }
15 |
16 | public function getName() {
17 | return 'user_edit_frontend';
18 | }
19 | }
--------------------------------------------------------------------------------
/src/Baikal/FrontendBundle/Menu/Builder.php:
--------------------------------------------------------------------------------
1 | container->get('security.context');
13 | $user = $securityContext->getToken()->getUser();
14 |
15 | $menu = $factory->createItem('root', array('childrenAttributes' => array('class' => 'nav navbar-nav')));
16 |
17 | if($securityContext->isGranted('ROLE_FRONTEND_USER')) {
18 | $menu->addChild('Calendars', array('route' => 'baikal_frontend_calendar_list'));
19 | $menu->addChild('Contacts', array('route' => 'baikal_frontend_addressbook_list'));
20 | $menu->addChild('My profile', array('route' => 'baikal_frontend_profile'));
21 | }
22 |
23 | $currentpath = $this->container->get('request')->getPathInfo();
24 |
25 | foreach($menu as $item) {
26 | $item->setCurrent((bool)preg_match('%^' . preg_quote($item->getUri()) . '%', $currentpath));
27 | }
28 |
29 | return $menu;
30 | }
31 | }
--------------------------------------------------------------------------------
/src/Baikal/FrontendBundle/Resources/config/config.yml:
--------------------------------------------------------------------------------
1 | imports:
2 | # - { resource: assets.yml }
--------------------------------------------------------------------------------
/src/Baikal/FrontendBundle/Resources/config/services.yml:
--------------------------------------------------------------------------------
1 | services:
2 | baikal_frontend.access_denied_handler:
3 | class: Baikal\FrontendBundle\Service\AccessDeniedHandler
4 | arguments:
5 | - @http_kernel
6 | - @security.context
7 | - @router
8 | tags:
9 | - { name: kernel.event_listener, event: security.kernel_response, method: handle }
10 |
11 |
12 | baikal_frontend.oauth_preloginredirect_formauthenticationentrypoint:
13 | class: Baikal\FrontendBundle\Service\OAuthPreLoginRedirectFormAuthenticationEntryPoint
14 | arguments:
15 | - @http_kernel
16 | - @security.http_utils
17 | - 'hello'
18 | - false
--------------------------------------------------------------------------------
/src/Baikal/FrontendBundle/Resources/doc/index.rst:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sabre-io/Baikal2/b5142938b8e5dde693f31ff52e061f2d2810aee2/src/Baikal/FrontendBundle/Resources/doc/index.rst
--------------------------------------------------------------------------------
/src/Baikal/FrontendBundle/Resources/translations/messages.fr.xlf:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Symfony2 is great
7 | J'aime Symfony2
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/src/Baikal/FrontendBundle/Resources/views/Addressbook/form.html.twig:
--------------------------------------------------------------------------------
1 | {% extends "BaikalFrontendBundle:Layouts:standard.html.twig" %}
2 |
3 | {% block content %}
4 |
5 | {% set new = not (addressbook is defined and addressbook.id) %}
6 |
7 | {% embed "BaikalViewComponentsBundle:Components:pageheader.html.twig" %}
8 | {% set icon = "book" %}
9 | {% block header %}
10 | Addressbooks
11 |
12 |
13 |
14 | {% if new %}
15 | New
16 | {% else %}
17 | {{ addressbook.displayName() }}
18 |
19 |
20 |
21 | Edit
22 | {% endif %}
23 |
24 | {% endblock %}
25 | {% endembed %}
26 |
27 | {% embed "BaikalViewComponentsBundle:Components:Addressbook/form.html.twig" with {
28 | new: new,
29 | url_cancel: path('baikal_frontend_addressbook_list')
30 | } %}{% endembed %}
31 |
32 | {% endblock %}
--------------------------------------------------------------------------------
/src/Baikal/FrontendBundle/Resources/views/Addressbook/list.html.twig:
--------------------------------------------------------------------------------
1 | {% extends "BaikalFrontendBundle:Layouts:standard.html.twig" %}
2 |
3 | {% set pagetitle = "Contacts" %}
4 |
5 | {% block content %}
6 |
7 | {% embed "BaikalViewComponentsBundle:Components:pageheader.html.twig" %}
8 | {% set icon = "book" %}
9 | {% block header %}Addressbooks{% endblock %}
10 | {% endembed %}
11 |
12 | {% if addressbooks|length %}
13 | {% embed "BaikalViewComponentsBundle:Components:addbutton.html.twig" %}
14 | {% set button_url = path('baikal_frontend_addressbook_form_new') %}
15 | {% set button_text = ' Add book' %}
16 | {% endembed %}
17 |
18 | {% embed "BaikalViewComponentsBundle:Components:Addressbook/list.html.twig" with {
19 | 'items': addressbooks,
20 | 'user': user,
21 | 'urls': urls
22 | } %}{% endembed %}
23 | {% else %}
24 | {% embed "BaikalViewComponentsBundle:Components:nothinghere.html.twig" with {
25 | itemname: 'addressbook',
26 | actionurl: path('baikal_frontend_addressbook_form_new'),
27 | calltoaction: 'Create one now'
28 | } %}{% endembed %}
29 | {% endif %}
30 |
31 | {% endblock %}
32 |
33 | {% block scripts %}
34 | {% embed "BaikalViewComponentsBundle:Components:list.scripts.html.twig" %}{% endembed %}
35 | {% endblock %}
--------------------------------------------------------------------------------
/src/Baikal/FrontendBundle/Resources/views/Addressbook/view.html.twig:
--------------------------------------------------------------------------------
1 | {% extends "BaikalFrontendBundle:Layouts:standard.html.twig" %}
2 |
3 | {% set pagetitle = "Addressbook " ~ addressbook.getDisplayname() ~ " of " ~ user.uiLabel() %}
4 |
5 | {% block content %}
6 |
7 | {% embed "BaikalViewComponentsBundle:Components:pageheader.html.twig" %}
8 | {% set icon = "book" %}
9 | {% block header %}
10 |
11 | Addressbooks
12 |
13 |
14 |
15 | {{ addressbook.getDisplayname() }}
16 |
17 | {% endblock %}
18 | {% endembed %}
19 |
20 | {% embed "BaikalViewComponentsBundle:Components:SPA/cardclient.html.twig" with { addressbook: addressbook } %}{% endembed %}
21 |
22 | {% endblock %}
--------------------------------------------------------------------------------
/src/Baikal/FrontendBundle/Resources/views/Auth/loginform.html.twig:
--------------------------------------------------------------------------------
1 | {% extends "BaikalFrontendBundle:Layouts:standard.html.twig" %}
2 |
3 | {% set pagetitle = "Frontend auth" %}
4 |
5 | {% block content %}
6 |
7 |
8 | {% embed "BaikalViewComponentsBundle:Components:pageheader.html.twig" with { container: false, header: "Please sign in", icon: "lock" } %}{% endembed %}
9 |
10 |
11 |
12 |
13 | {% embed "BaikalViewComponentsBundle:Components:loginform.html.twig" with {
14 | logincheckurl: path('baikal_frontend_login_check'),
15 | redirecturl: path('baikal_frontend_homepage')
16 | } %}{% endembed %}
17 |
18 | {% endblock %}
--------------------------------------------------------------------------------
/src/Baikal/FrontendBundle/Resources/views/Auth/oauthloginform.html.twig:
--------------------------------------------------------------------------------
1 | {% extends "BaikalFrontendBundle:Layouts:standard.html.twig" %}
2 |
3 | {% set pagetitle = "OAuth authentication" %}
4 |
5 | {% block content %}
6 |
7 |
8 | {% embed "BaikalViewComponentsBundle:Components:pageheader.html.twig" with { container: false, header: "Please sign in to proceed", icon: "lock" } %}{% endembed %}
9 |
A third party application has requested access to your Baïkal account. Please, sign in to proceed with the application authorization.
10 |
11 |
12 |
13 |
14 | {% embed "BaikalViewComponentsBundle:Components:loginform.html.twig" with {
15 | logincheckurl: path('baikal_frontend_oauth_login_check')
16 | } %}{% endembed %}
17 |
18 | {% endblock %}
--------------------------------------------------------------------------------
/src/Baikal/FrontendBundle/Resources/views/Calendar/form.html.twig:
--------------------------------------------------------------------------------
1 | {% extends "BaikalFrontendBundle:Layouts:standard.html.twig" %}
2 |
3 | {% block content %}
4 |
5 | {% set new = not (calendar is defined and calendar.id) %}
6 |
7 | {% embed "BaikalViewComponentsBundle:Components:pageheader.html.twig" %}
8 | {% set icon = "calendar" %}
9 | {% block header %}
10 | Calendars
11 |
12 |
13 |
14 | {% if new %}
15 | New
16 | {% else %}
17 | {% include "BaikalViewComponentsBundle:Components:calendarpill.html.twig" with { calendar: calendar } %} {{ calendar.displayName() }}
18 |
19 |
20 |
21 | Edit
22 | {% endif %}
23 |
24 | {% endblock %}
25 | {% endembed %}
26 |
27 | {% embed "BaikalViewComponentsBundle:Components:Calendar/form.html.twig" with {
28 | new: new,
29 | url_cancel: path('baikal_frontend_calendar_list')
30 | } %}{% endembed %}
31 |
32 | {% endblock %}
33 |
34 | {% block scripts %}
35 | {% embed "BaikalViewComponentsBundle:Components:Calendar/form.scripts.html.twig" %}{% endembed %}
36 | {% endblock %}
--------------------------------------------------------------------------------
/src/Baikal/FrontendBundle/Resources/views/Calendar/instructions.html.twig:
--------------------------------------------------------------------------------
1 | {% extends "BaikalFrontendBundle:Layouts:standard.html.twig" %}
2 |
3 | {% set pagetitle = "Calendar " ~ calendar.getDisplayname() %}
4 |
5 | {% block content %}
6 |
7 | {% embed "BaikalViewComponentsBundle:Components:pageheader.html.twig" %}
8 | {% block header %}
9 |
10 | Calendars
11 |
12 |
13 |
14 | {% include "BaikalViewComponentsBundle:Components:calendarpill.html.twig" with { calendar: calendar } %} {{ calendar.getDisplayname() }}
15 |
16 |
17 |
18 | Connect
19 |
20 | {% endblock %}
21 | {% endembed %}
22 |
23 | {% embed "BaikalViewComponentsBundle:Components:Calendar/instructions.html.twig" with {
24 | user: user,
25 | calendar: calendar
26 | } %}{% endembed %}
27 |
28 | {% endblock %}
--------------------------------------------------------------------------------
/src/Baikal/FrontendBundle/Resources/views/Calendar/list.html.twig:
--------------------------------------------------------------------------------
1 | {% extends "BaikalFrontendBundle:Layouts:standard.html.twig" %}
2 |
3 | {% set pagetitle = "Calendars" %}
4 |
5 | {% block content %}
6 | {% embed "BaikalViewComponentsBundle:Components:pageheader.html.twig" %}
7 | {% set icon = "calendar" %}
8 | {% block header %}Calendars{% endblock %}
9 | {% endembed %}
10 |
11 | {% if calendars|length %}
12 | {% embed "BaikalViewComponentsBundle:Components:addbutton.html.twig" %}
13 | {% set button_url = path('baikal_frontend_calendar_form_new') %}
14 | {% set button_text = ' Add calendar' %}
15 | {% endembed %}
16 |
17 | {% embed "BaikalViewComponentsBundle:Components:Calendar/list.html.twig" with {
18 | 'user' : user,
19 | 'items' : calendars,
20 | 'urls': urls
21 | } %}{% endembed %}
22 | {% else %}
23 | {% embed "BaikalViewComponentsBundle:Components:nothinghere.html.twig" with {
24 | itemname: 'calendar',
25 | actionurl: path('baikal_frontend_calendar_form_new'),
26 | calltoaction: 'Create one now'
27 | } %}{% endembed %}
28 | {% endif %}
29 |
30 | {% endblock %}
31 |
32 | {% block scripts %}
33 | {% embed "BaikalViewComponentsBundle:Components:list.scripts.html.twig" %}{% endembed %}
34 | {% endblock %}
--------------------------------------------------------------------------------
/src/Baikal/FrontendBundle/Resources/views/Calendar/view.html.twig:
--------------------------------------------------------------------------------
1 | {% extends "BaikalFrontendBundle:Layouts:fullscreen.html.twig" %}
2 |
3 | {% set pagetitle = "Calendar " ~ calendar.getDisplayname() %}
4 |
5 | {% block bodyclass %}calendar-fullscreen{% endblock %}
6 |
7 | {% set calview = application('pulpy', {
8 | rootElement: '#app-calclient',
9 | parameters: {
10 | apiendpoint: '/webapi/v1',
11 | calendarsEnabledAtStart: [calendar.getId()],
12 | calendarFocusedAtStart: calendar.getId(),
13 | starttime: 0,
14 | endtime: 23,
15 | businessstarttime: 7,
16 | businessendtime: 20,
17 | hourbarwidth: 30,
18 | hourheight: 60,
19 | allowMovingToAdjacentWeeks: true,
20 | windowed: true,
21 | cosmetic: {
22 | gutterwidth: 16,
23 | event: {
24 | marginLeft: 2,
25 | marginTop: 2,
26 | marginBottom: 3
27 | },
28 | popup: {
29 | width: 300,
30 | height: 200
31 | }
32 | }
33 | }
34 | }) %}
35 |
36 | {% block content %}
37 |
38 | {{ calview.html|raw }}
39 | {% endblock %}
40 |
41 | {% block scripts %}
42 | {{ calview.assets|raw }}
43 | {% endblock %}
--------------------------------------------------------------------------------
/src/Baikal/FrontendBundle/Resources/views/Dashboard/index.html.twig:
--------------------------------------------------------------------------------
1 | {% extends "BaikalFrontendBundle:Layouts:standard.html.twig" %}
2 |
3 | {% set pagetitle = "Welcome" %}
4 |
5 | {% block content %}
6 |
7 |
8 | {% embed "BaikalViewComponentsBundle:Components:pageheader.html.twig" %}
9 | {% block header %}
10 |
11 | {% include "BaikalViewComponentsBundle:Components:avatar.textsize.html.twig" with { email: user.email } %} {{ user.uiLabel() }}, Welcome !
12 |
13 | {% endblock %}
14 | {% endembed %}
15 |
16 |
17 |
18 |
19 |
20 |
21 |
About me
22 |
TODO:
Here, information about my account, some of my next calendar events, and my upcoming todos.
23 |
24 |
25 |
License and credits
26 | {% embed "BaikalViewComponentsBundle:Components:Dashboard/license.html.twig" %}{% endembed %}
27 |
28 |
29 |
30 |
31 |
32 | {% endblock %}
--------------------------------------------------------------------------------
/src/Baikal/FrontendBundle/Resources/views/Layouts/fullscreen.html.twig:
--------------------------------------------------------------------------------
1 | {% extends "BaikalViewComponentsBundle:Layouts:standard.html.twig" %}
2 |
3 | {% block body %}
4 |
5 |
35 |
36 |
65 |
66 | {% block content %}
67 | Content here
68 | {% endblock %}
69 |
70 | {% endblock body %}
--------------------------------------------------------------------------------
/src/Baikal/FrontendBundle/Resources/views/Layouts/partials/_footer.html.twig:
--------------------------------------------------------------------------------
1 |
7 |
--------------------------------------------------------------------------------
/src/Baikal/FrontendBundle/Resources/views/Layouts/standard.html.twig:
--------------------------------------------------------------------------------
1 | {% extends "BaikalViewComponentsBundle:Layouts:standard.html.twig" %}
2 |
3 | {% block body %}
4 |
5 | {% include 'BaikalFrontendBundle:Layouts:partials/_header.html.twig' %}
6 |
7 | {% block content %}
8 | Content here
9 | {% endblock %}
10 |
11 | {% include 'BaikalFrontendBundle:Layouts:partials/_footer.html.twig' %}
12 |
13 | {% endblock body %}
--------------------------------------------------------------------------------
/src/Baikal/FrontendBundle/Resources/views/Profile/index.html.twig:
--------------------------------------------------------------------------------
1 | {% extends "BaikalFrontendBundle:Layouts:standard.html.twig" %}
2 |
3 | {% set pagetitle = "User profile" %}
4 |
5 | {% block content %}
6 |
7 | {% embed "BaikalViewComponentsBundle:Components:pageheader.html.twig" %}
8 |
9 | {% block header %}
10 |
11 | {% include "BaikalViewComponentsBundle:Components:avatar.textsize.html.twig" with { email: user.email } %} My profile
12 |
13 | {% endblock header %}
14 | {% endembed %}
15 |
16 |
43 |
44 | {% endblock %}
--------------------------------------------------------------------------------
/src/Baikal/FrontendBundle/Service/AccessDeniedHandler.php:
--------------------------------------------------------------------------------
1 | kernel = $http_kernel;
24 | $this->securityContext = $securityContext;
25 | $this->router = $router;
26 | }
27 |
28 | /**
29 | * Handles an access denied failure.
30 | *
31 | * @param Request $request
32 | * @param AccessDeniedException $accessDeniedException
33 | *
34 | * @return Response may return null
35 | */
36 | public function handle(Request $request, AccessDeniedException $accessDeniedException) {
37 |
38 | # First we check if user has an access granted to the admin
39 | if($this->securityContext->isGranted('ROLE_ADMIN') || $this->securityContext->isGranted('ROLE_STATIC_ADMIN')) {
40 | return new RedirectResponse($this->router->generate('baikal_admin_homepage'));
41 | }
42 |
43 | # If not, we display an "Access denied" message
44 | $attributes = array(
45 | '_controller' => 'BaikalCoreBundle:Security:accessDenied',
46 | 'exception' => $accessDeniedException,
47 | );
48 |
49 | $subRequest = $request->duplicate(array(), null, $attributes);
50 | return $this->kernel->handle($subRequest, HttpKernelInterface::SUB_REQUEST);
51 | }
52 | }
--------------------------------------------------------------------------------
/src/Baikal/FrontendBundle/Service/OAuthPreLoginRedirectFormAuthenticationEntryPoint.php:
--------------------------------------------------------------------------------
1 | render('BaikalSystemBundle:Security:accessDenied.html.twig');
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/Baikal/SystemBundle/DependencyInjection/BaikalSystemExtension.php:
--------------------------------------------------------------------------------
1 | processConfiguration($configuration, $configs);
24 |
25 | $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
26 | $loader->load('services.yml');
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/Baikal/SystemBundle/DependencyInjection/Configuration.php:
--------------------------------------------------------------------------------
1 | root('baikal_system');
22 |
23 | // Here you should define the parameters that are allowed to
24 | // configure your bundle. See the documentation linked above for
25 | // more information on that topic.
26 |
27 | return $treeBuilder;
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/Baikal/SystemBundle/Entity/User.php:
--------------------------------------------------------------------------------
1 |
2 | Baïkal - Access denied
3 |
4 | Baïkal - Access to this resource is denied.
5 |
6 |