Coder Social home page Coder Social logo

valb3r / time-tracker Goto Github PK

View Code? Open in Web Editor NEW
15.0 2.0 3.0 5.45 MB

Time tracker and corporate authorization portal example for groups and users with role inheritance and batch reporting. Backed by graph database, reactive endpoints and spring batch on Neo4j for reporting

Home Page: https://valb3r.github.io/time-tracker/

License: MIT License

Java 81.66% Shell 0.49% JavaScript 0.19% TypeScript 12.72% HTML 4.77% CSS 0.02% SCSS 0.16% Batchfile 0.01%
neo4j java timetracker graph webflux spring-batch spring-batch-neo4j authorization time-tracking-app time-tracker

time-tracker's Introduction

About the project

Typically, authorization applications include some form of group and user relationships. In particular, lots of organizations do use ActiveDirectory to protect resources like code repositories, virtual machines, etc. Such resource management, in essence, is backed by a user-group-resource relationship. This project aims to demonstrate the simplicity and cleanliness of the corporate authorization solution if it would be implemented using graphs and Neo4j in particular.

Desktop tracker

Desktop tracker is available at releases page, requires Java 8+

Tech stack:

  1. Spring Boot 2 with reactive WebFlux REST endpoints and security.
  2. Neo4j database with SDN-RX (endpoints) and OGM (reporting) access layers.
  3. Spring Batch with metadata persistence on Neo4j
  4. Angular / Angular material/flex for UI
  5. Gradle as build system.
  6. Dockerized deployment via docker-compose.

Demo environment

Demo environment to play with project is located here - https://demo.timetracker.tk

Demo users

Admin user at https://demo.timetracker.tk has admin/admin credentials. You can see an organization tree with this user. Typically, all other users have a password that is equal to the username - you can try petya/petya for example.

Why graph database?

Group and users' owned resources are clear:

Ownership diagram

Also, code that fetches those resources is simple too, exactly one query to read all owned groups:

MATCH (m:User)-[:IN_GROUP]->(g:Group)-[:HAS_CHILD*]->(r:Group) WHERE id(m) = $ownerId RETURN id(r) 
UNION MATCH (m:Group)-[:HAS_CHILD*]->(r:Group) WHERE id(m) = $ownerId RETURN id(r) 
UNION MATCH (m)-[role:MANAGER*]->(r:Group) WHERE id(m) = $ownerId AND (m:Group OR m:User) 
    AND NONE(
        dated in role WHERE (type(dated) IN ['MANAGER', 'DEVELOPER']) 
        AND (localdatetime() <= dated.from OR localdatetime() >= dated.to)
    )
RETURN id(r)

UI / Application look

Features:

  1. Complex user-group relations management including date based role validity (i.e. developer in project from 2019-01-01 to 2020-01-01).
  2. Simple to use time card entry and modification.
  3. Template-based report generation in xlsx format (using jxls templates).
  4. Reactive endpoints.

Report templates can be found here:

  1. By developer
  2. By project

Architecture

Architecture diagram

Build and run

Root project dir, execute these:

./gradlew clean buildImage
export TIMETRACKER_VERSION=`git rev-parse --verify --short HEAD`
docker-compose up 
# OR 'sudo -E docker-compose up' if you need sudo to run docker

Commands above spin up everything needed. UI will be at localhost:6500

Run from IDE

  1. Start the database using docker run --rm -d --publish=7474:7474 --publish=7687:7687 --volume=$HOME/neo4j/data:/data -e NEO4J_AUTH=neo4j/docker neo4j/neo4j-experimental:4.0.0-rc01

  2. Start administration module

  3. Start time-tracking-server

  4. Start worker (only needed if you want reports)

  5. Install and run UI:

    1. Install dependencies
    2. Install angular-cli: npm install -g @angular/cli
    3. Run UI: ng serve --port 6500 --proxy-config proxy.conf.json
  6. Open http://localhost:6500 - there you can play with user admin/admin

JWT token key generation

  1. openssl genrsa -out key_priv 2048
  2. openssl rsa -in key_priv -pubout -outform PEM -out key.pem
  3. openssl pkcs8 -topk8 -inform PEM -in key_priv -out key -nocrypt
  4. rm -f key_priv

Stub data

To create stub data:

  1. Ensure you have removed neo-db docker volume if it is not first start.
  2. docker-compose up
  3. run administration/src/main/resources/init.sh.

Important note - init.sh assumes that it is executed on clean database which was touched by administration application - that means clean neo4j started and administration app started but no users were added through UI.
Test users all have same password as their login. I.e. admin/admin

time-tracker's People

Contributors

dependabot[bot] avatar snyk-bot avatar valb3r avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

time-tracker's Issues

Create Spring-batch Neo4j integration module

Extract Neo4j integration code into a separate project and publish it to some artifact server (maven)

  • Extract neo4j-spring batch adapter
  • Create separate repository with neo4j spring batch
  • Publish neo4j spring batch adapter

CI/CD for demo site deployment

Need to have simple CI/CD that deploys JAR's and UI to demo.timetracker.tk on each commit to master. Currently no need to deploy nginx and database

Initial Github integration

Need to have scheduled batch job that loads commits based on users' alias from GitHub to provide suggestions to work done items.

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.