Skip to content

Instantly share code, notes, and snippets.

@innerdaze
Last active February 12, 2016 15:32
Show Gist options
  • Save innerdaze/3cf7a5b82fb88b006e97 to your computer and use it in GitHub Desktop.
Save innerdaze/3cf7a5b82fb88b006e97 to your computer and use it in GitHub Desktop.
method process
proc
begin
data lAction, string, Parameter('action')
data lAllowed, boolean, false
if (lAction == 'GET')
begin
; Boss
lAllowed = Role.resolveRole('boss', Session.context)
; SalesManager
lAllowed = Role.resolveRole('salesManager', Session.context)
; Salesman
lAllowed = Role.resolveRole('sales', Session.context)
if (!lAllowed)
throw new NotAllowedError() ; or whatever we have
else
.. return data
else if (lAction == 'POST')
begin
; Boss
lAllowed = Role.resolveRole('boss', Session.context)
if (!lAllowed)
throw new NotAllowedError() ; or whatever we have
else
.. write data
end
end
endmethod
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment