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

feature: next release (v1.8 expected) #467

Merged
merged 60 commits into from
Jan 23, 2025
Merged
Changes from 1 commit
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
f341ada
fix(api): Ensure ALL required classes for viewset are inherited
jon-nfc Jan 7, 2025
b65da4e
feat(api): Add item metadata to markdown field for renderable items
jon-nfc Jan 7, 2025
86b63ac
feat(api): Add item metadata to markdown field for renderable items
jon-nfc Jan 8, 2025
af96e47
feat(api): Add option to viewset to render field markdown metadata
jon-nfc Jan 8, 2025
d33dd0f
feat(core): Add related ticket field metadata to api meta
jon-nfc Jan 8, 2025
4faafb8
feat(core): Add ticket linked item field metadata to api meta
jon-nfc Jan 8, 2025
3e55c93
feat(core): Add ticket comment field metadata to api meta
jon-nfc Jan 8, 2025
f67fad8
fix(core): display_name is not a mandatory field for ticket linked item
jon-nfc Jan 8, 2025
229014e
fix(core): display_name is not a mandatory field for related ticket
jon-nfc Jan 8, 2025
f9d82a5
feat(api): Enable fetching related ticket metadata for the other side…
jon-nfc Jan 8, 2025
56fec0f
docs(core): update markdown docs for recent model ref changes
jon-nfc Jan 9, 2025
39307e7
feat(assistance): add category and org to model articles tab
jon-nfc Jan 9, 2025
76c71d6
test(assistance): Ensure category fields are present for model articles
jon-nfc Jan 9, 2025
b982489
feat(access): Add organization to team display_name
jon-nfc Jan 9, 2025
8f98f02
feat(itim): Ability to add external link to a service
jon-nfc Jan 9, 2025
31c125d
docs(itim): Update external link docs with filter docs and new servic…
jon-nfc Jan 9, 2025
00215f6
feat(settings): Add new field button text
jon-nfc Jan 9, 2025
a6fda85
test(settings): check to ensure API fields returned are present and c…
jon-nfc Jan 9, 2025
ba2d809
fix(core): Set user whom added comment as comment user
jon-nfc Jan 9, 2025
6007668
feat(api): fetch doc path for view metadata
jon-nfc Jan 12, 2025
e2da2b1
chore(api): remove empty string for documentation link
jon-nfc Jan 12, 2025
8bc7e62
docs(itam): Add path for OS docs
jon-nfc Jan 12, 2025
c778d4c
test(api): ensure documentation key and data is added to API metadata
jon-nfc Jan 12, 2025
6528550
fix(api): correctly return API exceptions for user to rectify
jon-nfc Jan 12, 2025
699a960
fix(access): Return API exception, not django
jon-nfc Jan 12, 2025
7e72bab
docs(core): update success and failure admonition boxes
jon-nfc Jan 12, 2025
6b6c05f
feat(base): Add django-prometheus for metrics export
jon-nfc Jan 13, 2025
cb3d645
feat(base): Add exporter to gunicorn
jon-nfc Jan 13, 2025
b5a2717
feat(base): Add exporter to celery
jon-nfc Jan 13, 2025
b87286c
feat(base): Dont enable metrics by default
jon-nfc Jan 13, 2025
39a1183
docs(administration): Add metrics
jon-nfc Jan 13, 2025
ed7452e
fix(base): Dynammic settings determined by if metrics are enabled
jon-nfc Jan 14, 2025
a5f870b
fix(base): metrics dir env var PROMETHEUS_MULTIPROC_DIR must ALWAYS e…
jon-nfc Jan 14, 2025
ea02798
test(app): refactor. order tests alphanumerical
jon-nfc Jan 14, 2025
ca1cc4e
test(app): metrics_enabled setings checks
jon-nfc Jan 14, 2025
ccb95c6
Merge pull request #469 from nofusscomputing/463-fix-doc-links
jon-nfc Jan 14, 2025
4314ec6
test: Initial k6s individual page speed test cases
jon-nfc Jan 16, 2025
bd07c83
refactor(access): prefetch team related fields
jon-nfc Jan 16, 2025
fefde28
fix(access): cached orgs is an int list
jon-nfc Jan 16, 2025
7f16a06
refactor(access): cache app settings during perm check
jon-nfc Jan 16, 2025
aa69163
docs(access): add page_speed test to contributing
jon-nfc Jan 16, 2025
6bf40e4
refactor: Move app_settings object to request object
jon-nfc Jan 18, 2025
e5d23cc
refactor(access): Move user perm logic to request.tenancy object
jon-nfc Jan 18, 2025
2d41d8a
feat(access): if organization object casted to int, return organizati…
jon-nfc Jan 18, 2025
7f79c84
feat(access): TenancyManager object to cache the users team lokkup
jon-nfc Jan 18, 2025
f08d335
test: update to cater for tenancy object in request
jon-nfc Jan 18, 2025
4d53e18
fix(access): use the request user teams within Manager
jon-nfc Jan 18, 2025
58ec0a8
fix(core): When adding a ticket, query for org
jon-nfc Jan 18, 2025
8f8c798
fix(api): Only attempt to access a app_settings object for org field …
jon-nfc Jan 18, 2025
995615c
fix(project): when creating a project, fetch the organization object
jon-nfc Jan 18, 2025
929c95c
fix(core): ensure when updating, reques.tenancy object perm checking …
jon-nfc Jan 18, 2025
9b40668
fix(access): use request object passed to has_object_permission
jon-nfc Jan 18, 2025
9b0575c
Merge pull request #473 from nofusscomputing/471-refactor-performance
jon-nfc Jan 18, 2025
ab06660
refactor(access): Dont override django middleware, create own for acc…
jon-nfc Jan 19, 2025
5735427
fix(core): User must be a required field for ticket comment
jon-nfc Jan 19, 2025
f6f957f
fix(core): triage user requires access to date fields for tickets
jon-nfc Jan 23, 2025
a2fdb03
test(core): Correct ticket tests as triage user is supposed to have …
jon-nfc Jan 23, 2025
03edd78
fix(core): triage user requires access to date fields for change, inc…
jon-nfc Jan 23, 2025
c69fc26
feat(python): update django 5.1.4 -> 5.1.5
jon-nfc Jan 23, 2025
6739672
Merge pull request #475 from nofusscomputing/465-further-work
jon-nfc Jan 23, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor: Move app_settings object to request object
ref: #473
  • Loading branch information
jon-nfc committed Jan 18, 2025
commit 6bf40e469c971125e93bc117039546e9c25862cf
19 changes: 19 additions & 0 deletions app/access/middleware/auth.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from django.contrib.auth.middleware import (
AuthenticationMiddleware,
SimpleLazyObject,
partial,
)

from settings.models.app_settings import AppSettings


class AuthenticationMiddleware(AuthenticationMiddleware):


def process_request(self, request):

super().process_request(request)

request.app_settings = AppSettings.objects.select_related('global_organization').get(
owner_organization = None
)
14 changes: 1 addition & 13 deletions app/access/mixins/permissions.py
Original file line number Diff line number Diff line change
@@ -264,8 +264,6 @@ def has_permission(self, request, view):
return False


_app_settings: any = None

def has_object_permission(self, request, view, obj):

try:
@@ -277,23 +275,13 @@ def has_object_permission(self, request, view, obj):

object_organization: int = getattr(view.get_obj_organization( obj = obj ), 'id', None)

if not self._app_settings:

from settings.models.app_settings import AppSettings

app_settings = AppSettings.objects.get(
owner_organization = None
)

self._app_settings = app_settings

if object_organization:

if(
object_organization
in view.get_permission_organizations( view.get_permission_required() )
or request.user.is_superuser
or getattr(self._app_settings.global_organization, 'id', 0) == int(object_organization)
or getattr(self.request.app_settings.global_organization, 'id', 0) == int(object_organization)
):

return True
10 changes: 2 additions & 8 deletions app/access/models.py
Original file line number Diff line number Diff line change
@@ -179,15 +179,9 @@ def get_queryset(self):

if request:

from settings.models.app_settings import AppSettings
if request.app_settings.global_organization:

app_settings = AppSettings.objects.prefetch_related('global_organization').get(
owner_organization = None
)

if app_settings.global_organization:

user_organizations += [ app_settings.global_organization.id ]
user_organizations += [ request.app_settings.global_organization.id ]

# user = request.user._wrapped if hasattr(request.user,'_wrapped') else request.user

6 changes: 2 additions & 4 deletions app/api/serializers/common.py
Original file line number Diff line number Diff line change
@@ -17,13 +17,11 @@ def get_queryset(self):
if defined.
"""

app_settings = AppSettings.objects.all()

queryset = Organization.objects.all()

if getattr(app_settings[0], 'global_organization', None):
if getattr(self.context['request'].app_settings, 'global_organization', None):

queryset = queryset.exclude(id=app_settings[0].global_organization.id)
queryset = queryset.exclude(id=self.context['request'].app_settings.global_organization.id)

return queryset

2 changes: 1 addition & 1 deletion app/app/settings.py
Original file line number Diff line number Diff line change
@@ -142,7 +142,7 @@
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.middleware.common.CommonMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'access.middleware.auth.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'core.middleware.get_request.RequestMiddleware',