mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
f4239fbfd3
1
.github/workflows/docker_latest.yaml
vendored
1
.github/workflows/docker_latest.yaml
vendored
@ -34,7 +34,6 @@ jobs:
|
|||||||
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
||||||
push: true
|
push: true
|
||||||
target: production
|
target: production
|
||||||
repository: inventree/inventree
|
|
||||||
tags: inventree/inventree:latest
|
tags: inventree/inventree:latest
|
||||||
- name: Image Digest
|
- name: Image Digest
|
||||||
run: echo ${{ steps.docker_build.outputs.digest }}
|
run: echo ${{ steps.docker_build.outputs.digest }}
|
||||||
|
1
.github/workflows/docker_stable.yaml
vendored
1
.github/workflows/docker_stable.yaml
vendored
@ -37,7 +37,6 @@ jobs:
|
|||||||
target: production
|
target: production
|
||||||
build-args:
|
build-args:
|
||||||
branch: stable
|
branch: stable
|
||||||
repository: inventree/inventree
|
|
||||||
tags: inventree/inventree:stable
|
tags: inventree/inventree:stable
|
||||||
- name: Image Digest
|
- name: Image Digest
|
||||||
run: echo ${{ steps.docker_build.outputs.digest }}
|
run: echo ${{ steps.docker_build.outputs.digest }}
|
||||||
|
1
.github/workflows/docker_tag.yaml
vendored
1
.github/workflows/docker_tag.yaml
vendored
@ -35,5 +35,4 @@ jobs:
|
|||||||
target: production
|
target: production
|
||||||
build-args:
|
build-args:
|
||||||
tag: ${{ github.event.release.tag_name }}
|
tag: ${{ github.event.release.tag_name }}
|
||||||
repository: inventree/inventree
|
|
||||||
tags: inventree/inventree:${{ github.event.release.tag_name }}
|
tags: inventree/inventree:${{ github.event.release.tag_name }}
|
||||||
|
@ -72,7 +72,10 @@ class InvenTreeMetadata(SimpleMetadata):
|
|||||||
|
|
||||||
# Remove any HTTP methods that the user does not have permission for
|
# Remove any HTTP methods that the user does not have permission for
|
||||||
for method, permission in rolemap.items():
|
for method, permission in rolemap.items():
|
||||||
if method in actions and not check(user, table, permission):
|
|
||||||
|
result = check(user, table, permission)
|
||||||
|
|
||||||
|
if method in actions and not result:
|
||||||
del actions[method]
|
del actions[method]
|
||||||
|
|
||||||
# Add a 'DELETE' action if we are allowed to delete
|
# Add a 'DELETE' action if we are allowed to delete
|
||||||
|
@ -296,9 +296,9 @@ class APITests(InvenTreeAPITestCase):
|
|||||||
|
|
||||||
actions = self.getActions(url)
|
actions = self.getActions(url)
|
||||||
|
|
||||||
# 'add' permission does not apply here!
|
self.assertEqual(len(actions), 2)
|
||||||
self.assertEqual(len(actions), 1)
|
|
||||||
self.assertIn('PUT', actions.keys())
|
self.assertIn('PUT', actions.keys())
|
||||||
|
self.assertIn('GET', actions.keys())
|
||||||
|
|
||||||
# Add some other permissions
|
# Add some other permissions
|
||||||
self.assignRole('part.change')
|
self.assignRole('part.change')
|
||||||
|
@ -216,7 +216,10 @@ class RuleSet(models.Model):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
# Print message instead of throwing an error
|
# Print message instead of throwing an error
|
||||||
logger.info(f"User '{user.name}' failed permission check for {table}.{permission}")
|
name = getattr(user, 'name', user.pk)
|
||||||
|
|
||||||
|
logger.info(f"User '{name}' failed permission check for {table}.{permission}")
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
Loading…
Reference in New Issue
Block a user