Hi Dawid,
It seems you are trying to use groups/roles as scopes. Are there any special reason for that? It may be more logical if keep scopes static and check role inside script.
For example:
http://gluu.org/edit
http://gluu.org/view
User A assigned to role Manager (edit,view)
User B assigned to role Viewer (view)
Then for view script may look like:
def authorize(self, context):
if (hasRole("Manager") or hasRole("Viewer")):
print "authorized"
return True
return False
Hope it helps.
Regards,
Yuriy Z