Skip to content

Commit

Permalink
Merge branch 'main' into 45-type-hints
Browse files Browse the repository at this point in the history
  • Loading branch information
grizz committed Oct 5, 2024
2 parents d60ca17 + e287caa commit e038884
Show file tree
Hide file tree
Showing 26 changed files with 1,036 additions and 914 deletions.
74 changes: 74 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ "main" ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "main" ]
schedule:
- cron: '40 8 * * 6'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'javascript', 'python' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

steps:
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality


# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"
23 changes: 11 additions & 12 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,16 @@ jobs:
- uses: actions/checkout@v2
- name: Install virtualenv from poetry
uses: 20c/workflows/poetry@v1
# poetry run pre-commit run --all-files
- name: Run linters
run: |
poetry run pre-commit run --all-files
poetry run pre-commit run --all-files
test:
needs: linting
strategy:
fail-fast: false
fail-fast: true
matrix:
os: [ "ubuntu-latest", "macos-latest" ]
python-version: [ "3.7", "3.8", "3.9", "3.10" ]
python-version: [ "3.8", "3.9", "3.10", "3.11" ]
runs-on: ${{ matrix.os }}
steps:
- name: Check out repository
Expand All @@ -30,13 +28,14 @@ jobs:
uses: 20c/workflows/poetry@v1
with:
python-version: ${{ matrix.python-version }}
- name: Run tests
- name: Install dependencies
run: |
poetry run tox
poetry run coverage report
# upload coverage stats
python -m pip install --upgrade pip
pip install tox tox-gh-actions
- name: Run tests
run: tox
- name: Upload coverage
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
fail_ci_if_error: true
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,18 @@


## Unreleased


## 2.0.0
### Added
- python3.11 support
- python3.10 support
- django4 support
- django4.2 support
- django3.2 support
### Removed
- python3.6 support
- python3.7 support
- django2.2 support
- django3.0 support
- django3.1 support
Expand Down
220 changes: 113 additions & 107 deletions CHANGELOG.yaml
Original file line number Diff line number Diff line change
@@ -1,131 +1,137 @@
1.0.0:
Unreleased:
added: []
fixed: []
changed: []
deprecated: []
removed: []
security: []
2.0.0:
added:
- grainy authentication backend
- django admin integration
- str_flags function
- PermissioManager.add_permission
- Default permissions for AnonymousUser
- decorators.grainy_view
- decorators.grainy_rest_viewset
- helpers.dict_get_namespace
- helpers.request_method_to_flag
- helpers.request_to_flag
- util.Permissions.grant_all property
- conf.REQUEST_METHOD_TO_FLAG
changed:
- renamed `convert_flags` to `int_flags`
- moved `str_flags` and `int_flags` functions from util.py to helpers.py
- moved `namespace` function from util.py to models.py
- removed `clear` argument from `PermissionManager.add_permission_set`
- python3.11 support
- python3.10 support
- django4 support
- django4.2 support
- django3.2 support
removed:
- python3.6 support
- python3.7 support
- django2.2 support
- django3.0 support
- django3.1 support
1.9.1:
fixed:
- util.Permissions now accepts AnonynmousUser as object
1.1.0:
added:
- Passing a `tuple` or `list` to `helpers.namespace` will now return a joint namespace
of all contained elements
- Implemented `util.Permissions.instances` method to retrieve all instances of a
model according to permissions
- '`decorators.grainy_view` decorator can now use url parameters to format it s
namespace'
1.2.0:
- bug where group permissions overwrote direct permissions
1.9.0:
added:
- 'Permissions.instances(): add `explicit` keyword argument'
- 'Permissions.instances(): add `ignore_grant_all` keyword argument'
- 'Permissions.check(): add `ignore_grant_all` keyword argument'
1.2.1:
- python3.9 support
- django3.1 support
- added rest.ModelViewSetPermission django-rest-framework permission class
- added grainy_namespace property to decorated models
- added util.check_permissions helper function
- added util.get_permissions helper function
- added GRAINY_ANONYMOUS_GROUP setting
fixed:
- Template files not being installed
1.3.0:
- fix django-admin user and group admin view unregister
- fix instance namespacing on decorated models that have a grainy parent defined
changed:
- grainy handler classes moved to handlers.py to prevent circular depdendency issue
1.8.0:
added:
- 'grainy_model: allow specifying of custom instance namespace formatting'
- 'grainy_view: impl explicit namespace handling during request gating'
1.4.0:
- remote grainy permissions
- field level permission checks when POST/PUT/PATCHing to REST api (#14)
- python3.8 support
changed:
- 'fix #36: Grainy decorators should allow setting of Permissions class to use for
permission checks'
removed:
- python2.7 support
- python3.4 support
- python3.5 support
- django1.11 support
1.7.0:
added:
- implemented `decorators.grainy_view_response`
- implemented `decorators.grainy_json_view_response`
- implemented `decorators.grainy_rest_viewset_response`
- tests for django 2.1
- 'fix #33: easy namespace inheritance through related models'
- 'fix #31: add delete_permission function to grainy manager'
- 'fix #35: Custom permission holder implementation'
fixed:
- 'admin inlines: sort by namespace alphabetically (#24)'
changed:
- '`decorators.grainy_view` now simply decorates all response handlers'
- '`decorators.grainy_json_view` now simply decorates all response handlers'
- '`decorators.grainy_rest_viewset` now simply decorates all response handlers'
- move from facsimile to Ctl (#32)
1.6.2:
fixed:
- when applying perms to a grainy view response, make sure to return the proper
container when it is empty
1.6.1:
fixed:
- Fixed issue with namespace formatting for grainy views that was introduced in
1.6.0 where trying to format using url parameters would raise a KeyError
1.6.0:
added:
- grainy view decorators can now access the request object when formatting namespaces
- you can now use extra keyword arguments passed to `Grainy.namespace` and `helpers.namespace`
to further format the namespace string
changed:
- 'grainy view decorators: renamed `explicit_object` to `explicit_instance`'
1.5.0:
added:
- '`util.Permissions.get` now accepts the `explicit` keyword argument'
- '`decorators.grainy_view` now accepts the `explicit_object` keyword argument'
fixed:
- '`util.Permissions.get` now works correctly'
changed:
- '`decorators.grainy_view` request GET parameters now available for namespace formatting'
- '`decorators.grainy_view` get_object() now available as `instance` for base namespace
formatting if it exists'
- '`decorators.grainy_decorator` decorator namespaces can now be passed as lists
in which case the resulting namespace is a joint namespace of all the elements'
fixed:
- '`util.Permissions.get` now works correctly'
1.6.0:
1.4.0:
added:
- grainy view decorators can now access the request object when formatting namespaces
- you can now use extra keyword arguments passed to `Grainy.namespace` and `helpers.namespace`
to further format the namespace string
- implemented `decorators.grainy_view_response`
- implemented `decorators.grainy_json_view_response`
- implemented `decorators.grainy_rest_viewset_response`
changed:
- 'grainy view decorators: renamed `explicit_object` to `explicit_instance`'
1.6.1:
fixed:
- Fixed issue with namespace formatting for grainy views that was introduced in
1.6.0 where trying to format using url parameters would raise a KeyError
1.6.2:
fixed:
- when applying perms to a grainy view response, make sure to return the proper
container when it is empty
1.7.0:
- '`decorators.grainy_view` now simply decorates all response handlers'
- '`decorators.grainy_json_view` now simply decorates all response handlers'
- '`decorators.grainy_rest_viewset` now simply decorates all response handlers'
1.3.0:
added:
- tests for django 2.1
- 'fix #33: easy namespace inheritance through related models'
- 'fix #31: add delete_permission function to grainy manager'
- 'fix #35: Custom permission holder implementation'
changed:
- move from facsimile to Ctl (#32)
- 'grainy_model: allow specifying of custom instance namespace formatting'
- 'grainy_view: impl explicit namespace handling during request gating'
1.2.1:
fixed:
- 'admin inlines: sort by namespace alphabetically (#24)'
1.8.0:
- Template files not being installed
1.2.0:
added:
- remote grainy permissions
- field level permission checks when POST/PUT/PATCHing to REST api (#14)
- python3.8 support
changed:
- 'fix #36: Grainy decorators should allow setting of Permissions class to use for
permission checks'
removed:
- python2.7 support
- python3.4 support
- python3.5 support
- django1.11 support
1.9.0:
- 'Permissions.instances(): add `explicit` keyword argument'
- 'Permissions.instances(): add `ignore_grant_all` keyword argument'
- 'Permissions.check(): add `ignore_grant_all` keyword argument'
1.1.0:
added:
- python3.9 support
- django3.1 support
- added rest.ModelViewSetPermission django-rest-framework permission class
- added grainy_namespace property to decorated models
- added util.check_permissions helper function
- added util.get_permissions helper function
- added GRAINY_ANONYMOUS_GROUP setting
changed:
- grainy handler classes moved to handlers.py to prevent circular depdendency issue
fixed:
- fix django-admin user and group admin view unregister
- fix instance namespacing on decorated models that have a grainy parent defined
1.9.1:
fixed:
- bug where group permissions overwrote direct permissions
Unreleased:
- Passing a `tuple` or `list` to `helpers.namespace` will now return a joint namespace
of all contained elements
- Implemented `util.Permissions.instances` method to retrieve all instances of a
model according to permissions
- '`decorators.grainy_view` decorator can now use url parameters to format it s
namespace'
1.0.0:
added:
- python3.10 support
- django4 support
- django3.2 support
changed: []
deprecated: []
fixed: []
removed:
- python3.6 support
- django2.2 support
- django3.0 support
- django3.1 support
security: []
- grainy authentication backend
- django admin integration
- str_flags function
- PermissioManager.add_permission
- Default permissions for AnonymousUser
- decorators.grainy_view
- decorators.grainy_rest_viewset
- helpers.dict_get_namespace
- helpers.request_method_to_flag
- helpers.request_to_flag
- util.Permissions.grant_all property
- conf.REQUEST_METHOD_TO_FLAG
fixed:
- util.Permissions now accepts AnonynmousUser as object
changed:
- renamed `convert_flags` to `int_flags`
- moved `str_flags` and `int_flags` functions from util.py to helpers.py
- moved `namespace` function from util.py to models.py
- removed `clear` argument from `PermissionManager.add_permission_set`
2 changes: 1 addition & 1 deletion Ctl/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.9.1.1
2.0.0
Loading

0 comments on commit e038884

Please sign in to comment.