#NEWLINE# def get_all_permissions( self , user , obj = None ) : #NEWLINE# #INDENT# 'Returns a set of permission strings that the user has.\n\n        This permission available to the user is derived from the user\'s\n        Keystone "roles".\n\n        The permissions are returned as ``"openstack.{{ role.name }}"``.\n        ' #NEWLINE# if ( user . is_anonymous ( ) or ( obj is not None ) ) : #NEWLINE# #INDENT# return set ( ) #NEWLINE# #UNINDENT# role_perms = { utils . get_role_permission ( role [ 'name' ] ) for role in user . roles } #NEWLINE# services = [ ] #NEWLINE# for service in user . service_catalog : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# service_type = service [ 'type' ] #NEWLINE# #UNINDENT# except KeyError : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# service_regions = [ utils . get_endpoint_region ( endpoint ) for endpoint in service . get ( 'endpoints' , [ ] ) ] #NEWLINE# if ( user . services_region in service_regions ) : #NEWLINE# #INDENT# services . append ( service_type . lower ( ) ) #NEWLINE# #UNINDENT# #UNINDENT# service_perms = { ( 'openstack.services.%s' % service ) for service in services } #NEWLINE# return ( role_perms | service_perms )