Giter Club home page Giter Club logo

fablab's Introduction

fablab

Site de gestion du FabLab de CentraleLille

Installation

Install dependencies:

composer install
npm install -g bower
bower install

Install ElasticSearch :

Downdload & dezip V1.7.5 => https://www.elastic.co/downloads/past-releases/elasticsearch-1-7-5 Launch Elasticsearch

Bower will install bootstrap for layout.

Dev

###Integration

Local server at : http://172.31.4.227

It actualizes from GitHub once every day.

###Tests

Scripts tests.bat or tests.sh

We use the PSR-2 PHP Standard, you can test locally with this command :

./vendor/squizlabs/php_codesniffer/scripts/phpcs --standard=PSR2 src/

Use the code fixer with phpcbf instead of phpcs

./vendor/squizlabs/php_codesniffer/scripts/phpcbf --standard=PSR2 src/

For windows :

php ./vendor/squizlabs/php_codesniffer/scripts/phpcs --standard=PSR2 src/ --no-patch

Configure database and load Data Fixtures

php app/console doctrine:database:drop --force
php app/console doctrine:database:create
php app/console doctrine:schema:create
php app/console doctrine:fixtures:load

Roles et control access

4 rôles :
  • Rôle de type normal (scope = tout le site) :
    • ROLE_ADMIN : Permet d'accéder à tout et d'effectuer toutes les actions
    • ROLE_USER : Permet de voir les projets (rôle par défaut lorsqu'on possède un compte)
  • Rôle de type projet (scope = projet) :
    • PROJECT_MEMBER : Permet d'accéder aux parties privées de la page projet (rôle par défaut lorsqu'on est membre du projet)
    • PROJECT_LEADER : Permet d'effectuer des actions supplémentaires dans les pages privées du projet
Liste de l'ensemble des utilisateurs, leurs projets et leurs rôles

URL : /users

Restreindre l'accès des pages privées du projet aux membres

Il suffit d'ajouter deux lignes de code du controlleur Ex : ProjectController

    /**
     * @Route("/edit/{projectId}", name="project_edit")
     * @param $projectId
     * @return \Symfony\Component\HttpFoundation\Response
     */
    public function editAction($projectId)
    {
        ...

        /**
         * Control access for members only
         */
        $this->denyAccessUnlessGranted(ProjectRole::PROJECT_ROLE_MEMBER, $project);

        return $this->render(
            'CustomFosUserBundle:Project:show.html.twig',
            array(
                'project' => $project,
                'currentUser' => $currentUser
            )
        );
    }
Ajouter un contrôle supplémentaire dans les pages twig pour le PROJECT_LEADER

Il suffit d'ajouter dans le template la ligne suivante:

{% if project_service.isAllowedLeader(currentUser, project) %}
    <p>This part is visible only by the PROJECT_LEADER</p>
{% endif %}

fablab's People

Contributors

alxckn avatar chcorbi avatar clementbat avatar crymsius avatar cypriengilbert avatar etiennesou avatar fsenepin avatar gredns01 avatar herbautmax avatar jameshyot avatar junkosgithub avatar knackyto avatar korween avatar march21 avatar mathieuchabas avatar matrix4155 avatar matthieulemoine avatar mlechapt avatar nalktar avatar nicolasdarbier avatar pierloui avatar rcrabie avatar samuellg avatar waldojeffers avatar yassinekhlayfia avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

fablab's Issues

Not working build system

Builds always fail because of a deprecated dependencie.

Can you fix it ?

Regards,
Matthieu Lemoine.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.