mirror of
git://git.yoctoproject.org/layerindex-web.git
synced 2025-07-19 20:59:01 +02:00
Add access controls to PatchDispositionAdmin
* Make patch / user fields non-editable for existing records (patch mostly because the list is huge for a drop-down) * User must be a superuser or the dispositioner to edit Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
This commit is contained in:
parent
87975ae489
commit
4e7c81a0b9
|
@ -179,8 +179,16 @@ class PatchAdmin(admin.ModelAdmin):
|
|||
return False
|
||||
|
||||
class PatchDispositionAdmin(admin.ModelAdmin):
|
||||
fields = ['patch', 'user', 'disposition', 'comment']
|
||||
search_fields = ['patch__path']
|
||||
list_filter = ['patch__recipe__layerbranch__layer__name', 'patch__recipe__layerbranch__branch__name']
|
||||
def get_readonly_fields(self, request, obj=None):
|
||||
readonly_fields = ['user']
|
||||
if obj:
|
||||
readonly_fields.append('patch')
|
||||
if not (request.user == obj.user or request.user.is_superuser):
|
||||
readonly_fields.append('disposition', 'comment')
|
||||
return readonly_fields
|
||||
|
||||
class IncFileAdmin(admin.ModelAdmin):
|
||||
search_fields = ['path']
|
||||
|
|
Loading…
Reference in New Issue
Block a user