Skip to content

Commit d55e848

Browse files
committed
add pre-commit with basic hooks
1 parent 2e2cc9e commit d55e848

File tree

18 files changed

+39
-32
lines changed

18 files changed

+39
-32
lines changed

.github/workflows/build.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ jobs:
3030
echo Finished successful build with Python $pythonversion
3131
# - name: Test with pytest
3232
# run: |
33-
# pytest -v tests
33+
# pytest -v tests

.pre-commit-config.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# See https://pre-commit.com for more information
2+
# See https://pre-commit.com/hooks.html for more hooks
3+
repos:
4+
- repo: https://github.com/pre-commit/pre-commit-hooks
5+
rev: v3.2.0
6+
hooks:
7+
- id: trailing-whitespace
8+
- id: end-of-file-fixer
9+
- id: check-toml
10+
- id: check-yaml
11+
- id: check-added-large-files

CHANGELOG.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
- Change MARA_XXX variables to functions to delay importing of imports
2121

22-
**required changes**
22+
**required changes**
2323

2424
- Update `mara-app` to `>=2.0.0`
2525

@@ -32,7 +32,7 @@
3232
- Remove functions `user_has_permission` and `current_user_has_permission` (they are now implemented in `mara_page.acl`)
3333
- Remove deprecated dependency_links
3434
- Bump minimum `mara-page` version to 1.4.0
35-
- In `current_user_has_permissions`: When requested for a parent resource, return `True` when permissions for one of the child resources exist
35+
- In `current_user_has_permissions`: When requested for a parent resource, return `True` when permissions for one of the child resources exist
3636

3737
**required changes**
3838

@@ -57,7 +57,7 @@ monkey_patch.patch(mara_page.acl.user_has_permissions)(mara_acl.permissions.user
5757

5858
- If not already the case, add these two dependencies to your project requirements.txt:
5959

60-
```
60+
```
6161
-e git+git@github.com:mara/mara-db.git@3.2.1#egg=mara-db
6262
-e git+git@github.com:mara/mara-page.git@1.4.0#egg=mara-page
6363
```
@@ -71,7 +71,7 @@ monkey_patch.patch(mara_page.acl.user_has_permissions)(mara_acl.permissions.user
7171
## 1.3.0 (2018-03-19)
7272

7373
- Replace sqlalchemy orm query logic with plain sql queries in order to avoid idling zombie connections
74-
74+
7575

7676
## 1.2.0 (2017-12-30)
7777

@@ -85,12 +85,11 @@ monkey_patch.patch(mara_page.acl.user_has_permissions)(mara_acl.permissions.user
8585

8686

8787

88-
## 1.0.0 - 1.0.4 (2017-03-10)
88+
## 1.0.0 - 1.0.4 (2017-03-10)
8989

9090
- Initial version
91-
- Refactored login
91+
- Refactored login
9292
- Added function `user_has_permission`
9393
- Login bug fix
9494
- Emails are always converted to lowercase before processing
9595
- Adapted to mara ui changes
96-

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ clean:
3030
mkdir -p .venv
3131
cd .venv && $(.PYTHON3) -m venv --copies --prompt='[$(shell basename `pwd`)/.venv]' .
3232

33-
.venv/bin/python -m pip install --upgrade pip
33+
.venv/bin/python -m pip install --upgrade pip

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@
77

88
Default ACL implementation for mara with the following design choices:
99

10-
- Authentication of users is handled externally, e.g. through a [OAuth2 Proxy](https://github.com/oauth2-proxy/oauth2-proxy).
10+
- Authentication of users is handled externally, e.g. through a [OAuth2 Proxy](https://github.com/oauth2-proxy/oauth2-proxy).
1111
An upstream authentication app manages authentication and then adds a http header identifying the user to each authenticated request.
1212
- Each user is assigned a single role.
13-
- Permissions are not based on urls, but on application-defined "resources".
13+
- Permissions are not based on urls, but on application-defined "resources".
1414
Thus, checking of permissions needs to be done in the application.
1515

16-
The ACL provides a single UI for both user and permission management.
16+
The ACL provides a single UI for both user and permission management.
1717
Users can be added / removed and their roles can be changed like this:
1818
![User management](https://github.com/mara/mara-acl/raw/main/docs/_static/users-and-roles.gif)
1919

2020
New roles are created by moving a user to a new role.
2121

22-
Permissions can be set for
22+
Permissions can be set for
2323

2424
- an individual user or a whole role,
2525
- an individual resource, a group of resources or "All" resources.
@@ -28,11 +28,11 @@ Individual users inherit permissions from their role, and permissions on higher
2828
![User management](https://github.com/mara/mara-acl/raw/main/docs/_static/permissions.gif)
2929

3030

31-
Each new user that is authenticated is automatically created
31+
Each new user that is authenticated is automatically created
3232
with a default role in the acl:
3333
![User management](https://github.com/mara/mara-acl/raw/main/docs/_static/automatic-user-creation.png)
3434

35-
This behavior can be switched off (so that only invited users can join). See [config.py](https://github.com/mara/mara-acl/blob/main/mara_acl/config.py) for details.
35+
This behavior can be switched off (so that only invited users can join). See [config.py](https://github.com/mara/mara-acl/blob/main/mara_acl/config.py) for details.
3636

3737

3838
Please have a look at the mara example application for how to integrate this ACL implementation.

docs/changes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
```{include} ../CHANGELOG.md
2-
```
2+
```

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,4 @@
6060
html_static_path = ['_static']
6161
html_favicon = "_static/favicon.ico"
6262
html_logo = "_static/mara-animal.jpg"
63-
html_title = f"Mara ACL Documentation ({version})"
63+
html_title = f"Mara ACL Documentation ({version})"

docs/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ Legal information and changelog are here for the interested.
3636
:maxdepth: 2
3737

3838
license
39-
changes
39+
changes

docs/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
sphinx==4.5.0
2-
myst-parser==0.18.0
2+
myst-parser==0.18.0

docs/user-and-permission-management.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
User and permission management
22
==============================
33

4-
The module provides a single UI for both user and permission management.
4+
The module provides a single UI for both user and permission management.
55
Users can be added / removed and their roles can be changed like this:
66
![User management](https://github.com/mara/mara-acl/raw/main/docs/_static/users-and-roles.gif)
77

88

99
Automatic user creation
1010
-----------------------
1111

12-
Each new user that is authenticated is automatically created
12+
Each new user that is authenticated is automatically created
1313
with a default role in the acl:
1414
![User management](https://github.com/mara/mara-acl/raw/main/docs/_static/automatic-user-creation.png)
1515

@@ -21,7 +21,7 @@ Managing permissions for users and roles
2121

2222
New roles are created by moving a user to a new role.
2323

24-
Permissions can be set for
24+
Permissions can be set for
2525

2626
- an individual user or a whole role,
2727
- an individual resource, a group of resources or "All" resources.

0 commit comments

Comments
 (0)