#NEWLINE# def test_user_has_resource_db_permission( self ) : #NEWLINE# #INDENT# resolver = ExecutionPermissionsResolver ( ) #NEWLINE# all_permission_types = PermissionType . get_valid_permissions_for_resource_type ( ResourceType . EXECUTION ) #NEWLINE# all_permission_types . remove ( PermissionType . EXECUTION_LIST ) #NEWLINE# resource_db = self . resources [ 'exec_1' ] #NEWLINE# user_db = self . users [ 'admin' ] #NEWLINE# self . assertTrue ( self . _user_has_resource_db_permissions ( resolver = resolver , user_db = user_db , resource_db = resource_db , permission_types = all_permission_types ) ) #NEWLINE# user_db = self . users [ 'observer' ] #NEWLINE# self . assertTrue ( resolver . user_has_resource_db_permission ( user_db = user_db , resource_db = self . resources [ 'exec_1' ] , permission_type = PermissionType . EXECUTION_VIEW ) ) #NEWLINE# self . assertFalse ( resolver . user_has_resource_db_permission ( user_db = user_db , resource_db = self . resources [ 'exec_1' ] , permission_type = PermissionType . EXECUTION_STOP ) ) #NEWLINE# self . assertFalse ( resolver . user_has_resource_db_permission ( user_db = user_db , resource_db = self . resources [ 'exec_1' ] , permission_type = PermissionType . EXECUTION_ALL ) ) #NEWLINE# user_db = self . users [ 'no_roles' ] #NEWLINE# self . assertFalse ( self . _user_has_resource_db_permissions ( resolver = resolver , user_db = user_db , resource_db = resource_db , permission_types = all_permission_types ) ) #NEWLINE# user_db = self . users [ '1_custom_role_no_permissions' ] #NEWLINE# self . assertFalse ( self . _user_has_resource_db_permissions ( resolver = resolver , user_db = user_db , resource_db = resource_db , permission_types = all_permission_types ) ) #NEWLINE# user_db = self . users [ 'custom_role_unrelated_pack_action_grant' ] #NEWLINE# self . assertFalse ( self . _user_has_resource_db_permissions ( resolver = resolver , user_db = user_db , resource_db = resource_db , permission_types = all_permission_types ) ) #NEWLINE# user_db = self . users [ 'custom_role_pack_action_grant_unrelated_permission' ] #NEWLINE# self . assertFalse ( self . _user_has_resource_db_permissions ( resolver = resolver , user_db = user_db , resource_db = resource_db , permission_types = all_permission_types ) ) #NEWLINE# user_db = self . users [ 'custom_role_pack_action_view_grant' ] #NEWLINE# self . assertTrue ( resolver . user_has_resource_db_permission ( user_db = user_db , resource_db = resource_db , permission_type = PermissionType . EXECUTION_VIEW ) ) #NEWLINE# self . assertFalse ( resolver . user_has_resource_db_permission ( user_db = user_db , resource_db = resource_db , permission_type = PermissionType . EXECUTION_RE_RUN ) ) #NEWLINE# user_db = self . users [ 'custom_role_action_view_grant' ] #NEWLINE# self . assertTrue ( resolver . user_has_resource_db_permission ( user_db = user_db , resource_db = all_permission_types , permission_type = PermissionType . EXECUTION_VIEW ) ) #NEWLINE# self . assertFalse ( resolver . user_has_resource_db_permission ( user_db = user_db , resource_db = resource_db , permission_type = PermissionType . EXECUTION_RE_RUN ) ) #NEWLINE# user_db = self . users [ 'custom_role_pack_action_execute_grant' ] #NEWLINE# permission_types = [ PermissionType . EXECUTION_RE_RUN , PermissionType . EXECUTION_STOP ] #NEWLINE# self . assertTrue ( self . _user_has_resource_db_permissions ( resolver = resolver , user_db = user_db , resource_db = resource_db , permission_types = permission_types ) ) #NEWLINE# permission_types = [ PermissionType . EXECUTION_VIEW , PermissionType . EXECUTION_ALL ] #NEWLINE# self . assertFalse ( self . _user_has_resource_db_permissions ( resolver = resolver , user_db = user_db , resource_db = resource_db , permission_types = permission_types ) ) #NEWLINE# user_db = self . users [ 'custom_role_action_execute_grant' ] #NEWLINE# permission_types = [ PermissionType . EXECUTION_RE_RUN , PermissionType . EXECUTION_STOP ] #NEWLINE# self . assertTrue ( self . _user_has_resource_db_permissions ( resolver = resolver , user_db = user_db , resource_db = resource_db , permission_types = permission_types ) ) #NEWLINE# permission_types = [ PermissionType . EXECUTION_VIEW , PermissionType . EXECUTION_ALL ] #NEWLINE# self . assertFalse ( self . _user_has_resource_db_permissions ( resolver = resolver , user_db = user_db , resource_db = resource_db , permission_types = permission_types ) ) #NEWLINE# user_db = self . users [ 'custom_role_pack_action_all_grant' ] #NEWLINE# resource_db = self . resources [ 'exec_1' ] #NEWLINE# self . assertTrue ( self . _user_has_resource_db_permissions ( resolver = resolver , user_db = user_db , resource_db = resource_db , permission_types = all_permission_types ) ) #NEWLINE# user_db = self . users [ 'custom_role_action_all_grant' ] #NEWLINE# resource_db = self . resources [ 'exec_1' ] #NEWLINE# self . assertTrue ( self . _user_has_resource_db_permissions ( resolver = resolver , user_db = user_db , resource_db = resource_db , permission_types = all_permission_types ) )