-
-
Save marr/a5c93299ec1b7939ed1ca93587f03d7c to your computer and use it in GitHub Desktop.
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
def roles_update_permitted?(user) | |
new_roles = params.fetch(:staff, {}).fetch(:roles, []).map do |role| | |
role['type'] | |
end | |
(new_roles - accessible_roles).empty? | |
end |
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
{ | |
"staff" : { | |
"firstName" : "Hip", | |
"id" : 12, | |
"lastName" : "Hop", | |
"roles" : [], | |
"email" : "hiphop@gmail.com", | |
"country" : "UK" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment