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

Permissions and Code Review/Tidy #476

Merged
merged 29 commits into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
f967a85
Update: reviewed approval, compliance, and main serialisers, removed …
awf-dbca Oct 21, 2024
3addda9
Update: payment, proposal, and user serialisers reviewed
awf-dbca Oct 21, 2024
1bdeeba
Update: removing unused methods and properties for approval models, a…
awf-dbca Oct 21, 2024
c27678e
Update: continue reviewing approval models, applied rounding setting …
awf-dbca Oct 22, 2024
36ce016
Update: initial review of approval models done - auth to be added (if…
awf-dbca Oct 22, 2024
97a02bd
Update: addressed TODOs RE removal of unecessary fields and properties
awf-dbca Oct 22, 2024
c406847
Update: ongoing proposal models review
awf-dbca Oct 22, 2024
4a8a333
Update: replaced 50 max loop with proposal id check (should never loo…
awf-dbca Oct 22, 2024
3a4db53
Update: continue reviewing proposal models
awf-dbca Oct 23, 2024
01ec81e
Update: changes to main proposal model
awf-dbca Oct 23, 2024
b67ddd7
Update: renamed applicant address fields, removed same_as_residential…
awf-dbca Oct 23, 2024
68a2015
Update: complete proposal model review (some TODOs to be addressed)
awf-dbca Oct 23, 2024
f19bad0
Removed: unecessary proposal fields, including company ownership star…
awf-dbca Oct 24, 2024
d0dabd8
Update: fixed proposal requirments create
awf-dbca Oct 24, 2024
31d91dc
Update: made company viewset accessible by (only name and id, auth no…
awf-dbca Oct 24, 2024
4aa8179
Removed: unecessary compliance fields
awf-dbca Oct 24, 2024
4783688
Added: assessor auth to a number of compliance assessment functions
awf-dbca Oct 24, 2024
3a0338a
Update: finished compliance review, compliance amendment requests no …
awf-dbca Oct 24, 2024
123ca1c
Updatae: reviewed main, user, and payment models
awf-dbca Oct 24, 2024
f2b510c
Update: reviewed number of util and signal functions - some TODOs to …
awf-dbca Oct 24, 2024
783dfe2
Update: addressed each TODO - remaining TODOs to be addressed in late…
awf-dbca Oct 25, 2024
90c07e6
Added: basic permissions - IsAuthenticated, and InternalApprovalPermi…
awf-dbca Oct 25, 2024
7794758
Added: Approver and Assessor proposal permissions that check proposal…
awf-dbca Oct 25, 2024
61d3925
Added: compliance permissions
awf-dbca Oct 25, 2024
73e380c
Update: moved removeAUPFromMooring in to a viewset class (with permis…
awf-dbca Oct 25, 2024
061b7ae
Update: moved removeMooringFromApproval in to viewset class
awf-dbca Oct 28, 2024
b9db8a2
Update: removed permission reqs on fee success preload views to fix p…
awf-dbca Oct 28, 2024
d3766cd
Update: fixed permissions check
awf-dbca Oct 28, 2024
e56ea81
Merge branch 'main' into auth-perms-2
awf-dbca Oct 28, 2024
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
71 changes: 1 addition & 70 deletions mooringlicensing/admin.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
from django.contrib.admin import AdminSite
from django.contrib import admin
# from mooringlicensing.components.main import models
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import Group
from django.conf import settings

# from ledger.accounts import admin as ledger_admin
#from ledger.accounts.models import EmailUser, Document, Address, Profile
# from ledger.accounts.models import EmailUser
from ledger_api_client.ledger_models import EmailUserRO
from copy import deepcopy

admin.site.index_template = 'admin-index.html'
admin.autodiscover()
Expand All @@ -20,73 +11,13 @@ class MooringLicensingAdminSite(AdminSite):
index_title = 'Mooring Licensing Licensing'

mooringlicensing_admin_site = MooringLicensingAdminSite(name='mooringlicensingadmin')

# admin.site.unregister(EmailUser) # because this base classAdmin alsready registered in ledger.accounts.admin
# @admin.register(EmailUser)
# class EmailUserAdmin(admin.ModelAdmin):
# # class EmailUserAdmin(ledger_admin.EmailUserAdmin):
# """
# Overriding the EmailUserAdmin from ledger.accounts.admin, to remove is_superuser checkbox field on Admin page
# """
#
# def get_fieldsets(self, request, obj=None):
# """ Remove the is_superuser checkbox from the Admin page, if user is MooringLicensingAdmin and NOT superuser """
# fieldsets = super(UserAdmin, self).get_fieldsets(request, obj)
# #if not obj:
# # return fieldsets
#
# if request.user.is_superuser:
# return fieldsets
#
# # User is not a superuser, remove is_superuser checkbox
# fieldsets = deepcopy(fieldsets)
# for fieldset in fieldsets:
# if 'is_superuser' in fieldset[1]['fields']:
# if type(fieldset[1]['fields']) == tuple :
# fieldset[1]['fields'] = list(fieldset[1]['fields'])
# fieldset[1]['fields'].remove('is_superuser')
# break
#
# return fieldsets
#
#
# @admin.register(EmailUserRO)
# class EmailUserAdmin(admin.ModelAdmin):
# list_display = (
# "email",
# "first_name",
# "last_name",
# "is_staff",
# "is_active",
# )
# ordering = ("email",)
# search_fields = ("id", "email", "first_name", "last_name")
#
# def has_change_permission(self, request, obj=None):
# if obj is None: # and obj.status > 1:
# return True
# return None
#
# def has_delete_permission(self, request, obj=None):
# return None



@admin.register(EmailUserRO)
class EmailUserROAdmin(admin.ModelAdmin):
list_display = ('email','first_name','last_name','is_staff','is_active',)
ordering = ('email',)
search_fields = ('id','email','first_name','last_name')
readonly_fields = ['email','first_name','last_name','is_staff','is_active','user_permissions']

# def has_change_permission(self, request, obj=None):
# if obj is None: # and obj.status > 1:
# return True
# return None
def has_delete_permission(self, request, obj=None):
return False

# def get_readonly_fields(self, request, obj=None):
# if 'edit' not in request.GET:
# return self.readonly_fields
# else:
# return self.readonly_fields
1 change: 0 additions & 1 deletion mooringlicensing/components/approvals/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ class ApprovalAdmin(admin.ModelAdmin):
'start_date',
'expiry_date',
'current_proposal',
'replaced_by',
'applicant',
]
search_fields = ['lodgement_number',]
Expand Down
Loading
Loading