'Prints all passing policy rules for the given user.
:param api_name: If None, all passing policy rules will be printed,
otherwise, only passing policies that contain the
given api_name in their names.
:param target: The target against which the policy rule authorization
will be tested. If None, the given user will be
considered as the target.'

@cmd_common.args('--api-name', dest='api_name', metavar='<API    name>', help='Will    return    only    passing    policy    rules    containing    the    given    API    name.')
@cmd_common.args('--target', nargs='+', dest='target', metavar='<Target>', help=('Will    return    only    passing    policy    rules    for    the    given    target.    The    available    targets    are    %s.    When    "instance_id"    is    used,    the    other    targets    will    be    overwritten.' % ','.join(_ACCEPTABLE_TARGETS)))
def check(self, api_name=None, target=None):

    context = self._get_context()
    api_name = (api_name or '')
    target = self._get_target(context, target)
    allowed_operations = self._filter_rules(context, api_name, target)
    if allowed_operations:
        print '\n'.join(allowed_operations)
        return 0
    else:
        print 'No    rules    matched    or    allowed'
        return 1
