Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Roles and Permissions #803

Open
wants to merge 99 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 82 commits
Commits
Show all changes
99 commits
Select commit Hold shift + click to select a range
fddf5ac
Do not escape html for post order message
bagage Apr 28, 2019
6699ed0
Fix XSS and 500 error if version check fails
publicarray Dec 28, 2019
55e5dcb
Merge branch 'master' into version-check-fixes
samdb Apr 14, 2020
aa74389
Merge branch 'develop' into fix-post-order-display-message-escaping
johannac Apr 21, 2020
fd2b178
Merge pull request #629 from bagage/fix-post-order-display-message-es…
johannac Apr 21, 2020
117ab90
Merge branch 'develop' into version-check-fixes
johannac Apr 21, 2020
f959b28
Add installed function back to utils to fix 500 error in tests
johannac Apr 23, 2020
b8115fe
Consolidate two getVersionInfo functions into 1
johannac Apr 23, 2020
56ff9b7
Add unit test for new parse_version function
johannac Apr 23, 2020
bf017b6
Fix types in new parse_version function and expand regex a bit
johannac Apr 23, 2020
a471c08
Change version check to use github version file instead of old attend…
johannac Apr 23, 2020
ff56b58
Merge pull request #743 from publicarray/version-check-fixes
johannac Apr 23, 2020
6c894dc
Update ManageAccountController.php
chrisbrosnan Apr 28, 2020
b9842db
Merge pull request #789 from chrisbrosnan/develop
johannac May 12, 2020
d3da9a3
Add docker production environment
Leen15 Jul 13, 2018
7cd4248
fix typos
Leen15 Jul 13, 2018
0aa0901
Setup German translation and translate all emails
ftbastler Oct 11, 2018
6954ebc
German Translation of Footer.blade.php
Modding Oct 11, 2018
27ee0be
Translation of Emails
Modding Oct 11, 2018
ee07a0e
lang de erstellt und die ersten Dateien bearbeitet.
Modding Oct 11, 2018
d8624e8
weitere Dateien bearbeitet
Modding Oct 17, 2018
576e04b
Fees bearbeitet.
Modding Feb 21, 2019
5dc41a5
Installer.php bearbeitet
Modding Feb 21, 2019
89968e5
Installer.php fertiggestellt
Modding Feb 23, 2019
795693d
Javascript.php fertiggestellt
Modding Feb 23, 2019
bbb9641
anpassungen
Modding Mar 5, 2019
1e8a749
erste änderungen
Modding Mar 18, 2019
f161d62
Public_ViewEvent.php bearbeitet
Modding Mar 18, 2019
5b61c4c
Rechtschreibfehler
Modding Mar 19, 2019
a597805
anpassungen
Modding Mar 20, 2019
aff46bc
Prevent duplicate queries
AdrienPoupa Dec 7, 2018
d1dcc58
Update FirstRunMiddleware.php
AdrienPoupa Dec 10, 2018
0ccd792
Remove some duplicate queries
AdrienPoupa Dec 11, 2018
d2b5ce1
First commit Italian localization
falcecamogli Feb 19, 2020
9d77cf9
Fixed missed translation in Italian localization
falcecamogli Feb 19, 2020
acc1d4c
Added missing translations for Italian localization
falcecamogli Feb 19, 2020
64ae3cb
Fixed wrong translations for Italian localization
falcecamogli Feb 19, 2020
6f33ddb
Enable Italian locale
falcecamogli Feb 19, 2020
6cafbcb
Added missing translatable strings in Stripe, also for other languages
falcecamogli Feb 19, 2020
c3a7f5f
Fix translation for Italian localization
falcecamogli Feb 19, 2020
45c1114
Added missing translation label
falcecamogli Feb 19, 2020
426bd2a
Update dependencies and install roles and permissions package
May 30, 2020
6a1ad45
Add better minimal error pages
May 30, 2020
61987ed
Add permissions config, Add roles and permissions migrations. Add org…
May 30, 2020
be491bb
Link user to organiser. Fetch events with organisers
May 30, 2020
a79de4c
Add missing translations. Wrap UI parts in role/permissions checks to…
May 30, 2020
df3ea91
Add organiser to user in the test seeds. Add basic seeds for roles an…
May 30, 2020
60e01b9
Wrap organiser routes in the correct middleware checks for roles
May 30, 2020
4ddcd61
Add CanManageOrganisers middleware. Implicitly allow super admin user…
May 30, 2020
ce2d291
Cleanup the database seeder class names. Update the index controller …
May 30, 2020
00484cc
Bump version to 2.1.0
May 30, 2020
a8fe0bb
Fix regression in sending mail to a new user
May 30, 2020
7b9fbbb
Fix installer so it shows default values in the form
johannac May 27, 2020
b7a692c
Refactor docker config so nginx and php run on 1 container.
johannac May 27, 2020
96864f5
Add some comments to the docker set up
johannac May 27, 2020
5db7fa3
Add apache support
johannac May 28, 2020
1c33975
Fix the copy env file in makefile
johannac Jun 2, 2020
aea3126
Version bump
johannac Jun 2, 2020
a9db31b
Remove old compose file
johannac Jun 2, 2020
c8a679a
Add hCaptcha (#793)
publicarray Jun 3, 2020
17d061f
Add reCAPTCHA (#585)
publicarray Jun 3, 2020
42ff4a5
Update Fees.php (#810)
SamuelNitsche Jun 22, 2020
08d5f9e
Allow use of both reCaptcha hCaptcha or no capture based on config (#…
melvinthoabala Jun 22, 2020
d1184fa
Add min reqs to the readme file
johannac Jun 22, 2020
8fe013d
Add commands to makefile for clearing laravel cache and recompiling a…
johannac Jun 23, 2020
a8a3d0d
Add artisan migrate to the setup scripts in case there's database mig…
johannac Jun 23, 2020
9779bbd
Last name is required by the database schema so needs to be required …
johannac Jun 23, 2020
7c55e21
Fix redirect on the signup page - the import was missing, but also th…
johannac Jun 23, 2020
3cecc6e
Change the use of Utils::isAttendize() to Utils::isCloud() during the…
johannac Jun 23, 2020
092c5d2
Remove dupe translation
johannac Jun 23, 2020
5bffeaf
Refactor a bit of the captcha logic for the signup page
johannac Jun 23, 2020
ced63e9
Refactor login page to use captcha services
johannac Jun 23, 2020
16bb882
Refactor contact form page to use captcha services
johannac Jun 23, 2020
966ec2e
Use promises to initialise camera for check-in (#712)
scottyeung Jun 26, 2020
bd9fa02
Merge branch 'develop' into feature/roles-and-permissions
Jun 27, 2020
07f9594
Add seeder to run with migration to pre seed default roles and permis…
Jun 27, 2020
72d4e13
Update the account users UI with the roles assigned to the users in t…
Jun 27, 2020
bc6d1d8
Update the invite user form to take a first/last name along with emai…
Jun 27, 2020
97639a9
Layout the table better. Default select the user role for sensible de…
Jun 27, 2020
bbbf1f5
Update the user management screen with role selection dropdowns. Bind…
Jun 27, 2020
5abc186
Allow super admin users to give permission to User role types to mana…
Jun 27, 2020
8731f01
Clean up unused javascript
Jun 27, 2020
dadfd5f
Fix the error pages translations method
Jul 14, 2020
e578b64
Force the seed class to run on the migration to add permissions and r…
Jul 14, 2020
96836ef
Update the installation flow to include checks for first run and assi…
Jul 14, 2020
09c2925
Merge branch 'develop' into feature/roles-and-permissions
Jul 14, 2020
09b4507
Update the permissions seed to assign super admin roles to all legacy…
Jul 15, 2020
e182cd4
Merge with latest develop
quentincaffeino Aug 4, 2021
1ec0a39
Roles and Permissions: Deactivate, Restore and Delete users
quentincaffeino Aug 9, 2021
f77b59e
merge with origin/feature/roles-and-permissions
quentincaffeino Aug 9, 2021
43941ea
Merge branch 'feature/roles-and-permissions' into feature/roles-and-p…
quentincaffeino Aug 9, 2021
41dc199
Added prebuild backend js
quentincaffeino Aug 9, 2021
970634e
Created dropdownmenu to make things look better and to allow to fit m…
quentincaffeino Aug 9, 2021
1c426ae
Added `Send invitation` button
quentincaffeino Aug 9, 2021
451e4bf
fix: if user has no roles whole settings is broken, check if user has…
quentincaffeino Sep 23, 2021
8ec618e
Merge branch 'develop' into feature/roles-and-permissions-deleting-users
quentincaffeino Sep 23, 2021
b1c6856
fix: password is empty on user save
quentincaffeino Sep 24, 2021
d653d91
Merge pull request #957 from quentincaffeino/feature/roles-and-permis…
johannac Jan 6, 2023
a923618
Merge branch 'develop' into feature/roles-and-permissions
johannac Jan 6, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules
node_modules
.env
18 changes: 14 additions & 4 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
ATTENDIZE_DEV=true
ATTENDIZE_CLOUD=false

APP_NAME=Attendize
APP_ENV=production
APP_ENV=local
APP_KEY=
APP_DEBUG=false
APP_URL=
APP_DEBUG=true
APP_URL=https://localhost

LOG_CHANNEL=stack

Expand All @@ -28,7 +31,7 @@ MAIL_HOST=maildev
MAIL_PORT=25
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_ENCRYPTION=tls

AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
Expand All @@ -55,9 +58,16 @@ MAIL_FROM_NAME=testing_service
# https://github.com/NitMedia/wkhtml2pdf#driver-types
WKHTML2PDF_BIN_FILE=wkhtmltopdf-amd64

# Google Analytics
GOOGLE_ANALYTICS_ID=
GOOGLE_MAPS_GEOCODING_KEY=

# Captcha Configuration
CAPTCHA_IS_ON=false
# can be recaptcha or hcaptcha
CAPTCHA_TYPE=
CAPTCHA_SECRET=

TWITTER_WIDGET_ID=

LOG=errorlog
39 changes: 39 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Multi stage docker file for the Attendize application layer images

# Base image with nginx, php-fpm and composer built on debian
FROM wyveo/nginx-php-fpm:latest as base

# Set up code
WORKDIR /usr/share/nginx/html
COPY . .

# run composer, chmod files, setup laravel key
RUN ./scripts/setup

# The worker container runs the laravel queue in the background
FROM base as worker

CMD ["php", "artisan", "queue:work", "--daemon"]

# The web container runs the HTTP server and connects to all other services in the application stack
FROM base as web

# nginx config
COPY nginx.conf /etc/nginx/conf.d/default.conf

# self-signed ssl certificate for https support
RUN openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/nginx-selfsigned.key -out /etc/ssl/certs/nginx-selfsigned.crt -subj "/C=GB/ST=London/L=London/O=NA/CN=localhost" \
&& openssl dhparam -out /etc/ssl/certs/dhparam.pem 2048 \
&& mkdir /etc/nginx/snippets
COPY self-signed.conf /etc/nginx/snippets/self-signed.conf
COPY ssl-params.conf /etc/nginx/snippets/ssl-params.conf

# Ports to expose
EXPOSE 80
EXPOSE 443

# Starting nginx server
CMD ["/start.sh"]

# NOTE: if you are deploying to production with this image, you should extend this Dockerfile with another stage that
# performs clean up (i.e. removing composer) and installs your own dependencies (i.e. your own ssl certificate).
48 changes: 48 additions & 0 deletions Dockerfile-apache
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Run Attendize on an apache server
# Multi stage docker file for the Attendize application layer images

# Base image with apache, php, composer and mysql built on ubuntu
FROM leen15/apache-php-mysql as base

# install dependencies
RUN apt-get update && apt-get install -y \
libpq-dev \
libpng-dev \
libjpeg62-dev \
libfreetype6-dev \
libxrender1 \
libfontconfig \
libxext-dev \
libglib2.0-0 \
php-mysql \
php-pgsql \
php-gd \
php-zip \
zip \
unzip git nano

# Set up code
WORKDIR /var/www
COPY . .

# run composer, chmod files, setup laravel key
RUN ./scripts/setup

# The worker container runs the laravel queue in the background
FROM base as worker

CMD ["php", "artisan", "queue:work", "--daemon"]

# The web container runs the HTTP server and connects to all other services in the application stack
FROM base as web

# TODO: Add self signed SSL certificate

# Port to expose
EXPOSE 80

# Starting apache server
CMD ["/usr/sbin/apache2ctl", "-D", "FOREGROUND"]

# NOTE: if you are deploying to production with this image, you should extend this Dockerfile with another stage that
# performs clean up (i.e. removing composer) and installs your own dependencies (i.e. your own ssl certificate).
19 changes: 0 additions & 19 deletions Dockerfile-composer

This file was deleted.

8 changes: 0 additions & 8 deletions Dockerfile-nginx

This file was deleted.

14 changes: 0 additions & 14 deletions Dockerfile-php

This file was deleted.

45 changes: 45 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Commonly used commands, compatible with Linux type shells

# build the docker images for any environment
build:
docker build --tag attendize_base --target base .
docker build --tag attendize_worker --target worker --cache-from attendize_base:latest .
docker build --tag attendize_web --target web --cache-from attendize_worker:latest .

build-apache:
docker build --tag attendize_base --target base --file Dockerfile-apache .
docker build --tag attendize_worker --target worker --cache-from attendize_base:latest --file Dockerfile-apache .
docker build --tag attendize_web --target web --cache-from attendize_worker:latest --file Dockerfile-apache .

################
# The following commands are for local development use only and won't work in a production environment
################

# set up docker images and run containers for local development with docker-compose only
setup: build
cp .env.example .env
docker-compose up -d
docker-compose exec web ./scripts/setup
open https://localhost:8081/install
docker-compose exec web tail -f /var/log/nginx/access.log /var/log/nginx/error.log /var/log/php-fpm.log storage/logs/*

# run the whole stack and open up the app in the browser
run:
docker-compose up -d
open https://localhost:8081/

# open a bash prompt on a running web container
shell:
docker-compose exec web /bin/bash

# run the unit tests on a running web container
test:
docker-compose exec web bash -c "touch database/database.sqlite && vendor/bin/phpunit"

# clear all laravel caches on a running web container
cache:
docker-compose exec web php artisan optimize:clear

# clear and recompile the autoloder files, for example if you add a new class file
autoload:
docker-compose exec web composer dump-autoload
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,24 @@ Demo Back-end Demo: http://attendize.website/signup<br />
- Browser based QR code scanner for door management
- Elegant dashboard for easy management.

## Minimum Requirements

Attendize should run on most pre-configured LAMP or LEMP environments as long as certain requirements are adhered to. Attendize is based on the [Laravel Framework](https://laravel.com/)

**PHP Requirements**
1. PHP >= 7.1.3
2. OpenSSL PHP Extension
3. PDO PHP Extension
4. Mbstring PHP Extension
5. Tokenizer PHP Extension
6. Fileinfo PHP Extension
7. GD PHP Extension

**MySQL Requirements**
1. MySQL version 5.7 or higher required

## Contributing
Feel free to fork and contribute. If you are unsure about adding a feature create a Github issue to ask for Feedback. Read the [contribution guidelines](CONTRIBUTING.md)
Feel free to fork and contribute. If you are unsure about adding a feature, create a Github issue to ask for Feedback. Read the [contribution guidelines](CONTRIBUTING.md)

## Submitting an issue
If you encounter a bug in Attendize, please first search the list of current open [Issues on the GitHub repository](https://github.com/Attendize/Attendize/issues). You may add additional feedback on an existing bug report. If the issue you're having has not yet been reported, please open a new issue. There is a template available for new issues. Please fill out all information requested in the template so we can help you more easily.
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.0
2.0.2
13 changes: 13 additions & 0 deletions app/Attendize/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,4 +155,17 @@ public static function installed(): bool
{
return file_exists(base_path('installed'));
}

/**
* Safely parse a version number from a string
*
* @return string
*/
public static function parse_version($string): string
{
if (preg_match('/(\d+\.?\d+\.?\d+)/', $string, $matches) === 1) {
return $matches[0];
}
return '';
}
}
26 changes: 23 additions & 3 deletions app/Http/Controllers/EventViewController.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,22 @@
use Cookie;
use Illuminate\Http\Request;
use Mail;
use Redirect;
use Validator;
use Services\Captcha\Factory;

class EventViewController extends Controller
{
protected $captchaService;

public function __construct()
{
$captchaConfig = config('attendize.captcha');
if ($captchaConfig["captcha_is_on"]) {
$this->captchaService = Factory::create($captchaConfig);
}
}

/**
* Show the homepage for an event
*
Expand Down Expand Up @@ -90,9 +102,9 @@ public function showEventHomePreview($event_id)
public function postContactOrganiser(Request $request, $event_id)
{
$rules = [
'name' => 'required',
'email' => ['required', 'email'],
'message' => ['required'],
'name' => 'required',
'email' => 'required|email',
'message' => 'required',
];

$validator = Validator::make($request->all(), $rules);
Expand All @@ -104,6 +116,14 @@ public function postContactOrganiser(Request $request, $event_id)
]);
}

if (is_object($this->captchaService)) {
if (!$this->captchaService->isHuman($request)) {
return Redirect::back()
->with(['message' => trans("Controllers.incorrect_captcha"), 'failed' => true])
->withInput();
}
}

$event = Event::findOrFail($event_id);

$data = [
Expand Down
44 changes: 43 additions & 1 deletion app/Http/Controllers/IndexController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Auth;

class IndexController extends Controller
{
Expand All @@ -13,6 +14,47 @@ class IndexController extends Controller
*/
public function showIndex(Request $request)
{
return redirect()->route('showSelectOrganiser');
/** @var $user App\Models\User */
$user = Auth::user();

// super admin users will get shown the organiser selection page
if ($user->can('manage organisers')) {
return redirect()->route('showSelectOrganiser');
}

$isCheckinUser = $user->hasRole('attendee check in');

// Normal users will get shown their dashboard
$organiser = $user->organiser;
$allowed_sorts = ['created_at', 'start_date', 'end_date', 'title'];

$searchQuery = $request->get('q');
$sort_by = (in_array($request->get('sort_by'), $allowed_sorts) ? $request->get('sort_by') : 'start_date');

// If user can manage events, then they can see all events, otherwise just their own
$events = $organiser->events()
etiennemarais marked this conversation as resolved.
Show resolved Hide resolved
->where('organiser_id', $organiser->id)
->orderBy($sort_by, 'desc');

// We only want to filter for normal users here. Check in users get a limited event UI
if (!$user->can('manage events') && !$isCheckinUser) {
$events->where('user_id', $user->id);
}

if ($searchQuery) {
$events->where('title', 'like', '%' . $searchQuery . '%');
}

$data = [
'events' => $events->paginate(12),
'organiser' => $organiser,
'search' => [
'q' => $searchQuery ? $searchQuery : '',
'sort_by' => $request->get('sort_by') ? $request->get('sort_by') : '',
'showPast' => $request->get('past'),
],
];

return view('ManageOrganiser.Events', $data);
}
}