def list_exceptions(exception_id=None, states=None): """ List exceptions to Lifetime Model. :param id: The id of the exception :param states: The states to filter """ return lifetime_exception.list_exceptions(exception_id=exception_id, states=states)
def list_exceptions(exception_id=None, states=None): """ List exceptions to Lifetime Model. :param id: The id of the exception :param states: The states to filter """ exceptions = lifetime_exception.list_exceptions(exception_id=exception_id, states=states) for e in exceptions: yield api_update_return_dict(e)
def perm_update_lifetime_exceptions(issuer, kwargs, session=None): """ Checks if an account can approve/reject Lifetime Model exceptions. :param issuer: Account identifier which issues the command. :param session: The DB session to use :returns: True if account is allowed to call the API call, otherwise False """ if kwargs['vo'] is not None: exceptions = next(list_exceptions(exception_id=kwargs['exception_id'], states=False, session=session)) if exceptions['scope'].vo != kwargs['vo']: return False return _is_root(issuer) or has_account_attribute(account=issuer, key='admin', session=session)
def list_exceptions(exception_id=None, states=None, vo='def'): """ List exceptions to Lifetime Model. :param id: The id of the exception :param states: The states to filter :param vo: The VO to act on """ exceptions = lifetime_exception.list_exceptions(exception_id=exception_id, states=states) for e in exceptions: if vo == e['scope'].vo: yield api_update_return_dict(e)
def perm_update_lifetime_exceptions(issuer, kwargs, session=None): """ Checks if an account can approve/reject Lifetime Model exceptions. :param issuer: Account identifier which issues the command. :param kwargs: List of arguments for the action. :param session: The DB session to use :returns: True if account is allowed to call the API call, otherwise False """ if kwargs['vo'] is not None: exceptions = next( list_exceptions(exception_id=kwargs['exception_id'], states=False, session=session)) if exceptions['scope'].vo != kwargs['vo']: return False return perm_default(issuer, kwargs, session=session)