-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add callback to validate role assignment
Some dab-based apps like AWX may wish to add exceptions to the user and team role assignments. This PR adds logic to the serializer .create method to execute a callback method that is optionally defined on the model. This callback signature looks like: validate_role_assignment(self, actor, role_definition) and should return either - None - a string describing the validation error The string will be wrapped up a PermissionDenied error (HTTP 403) Signed-off-by: Seth Foster <[email protected]>
- Loading branch information
1 parent
ed8ab39
commit d11602a
Showing
3 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters