예제 #1
0
파일: rbac.py 프로젝트: rlugojr/st2
def _validate_resource_type(resource_db):
    """
    Validate that the permissions can be manipulated for the provided resource type.
    """
    resource_type = resource_db.get_resource_type()
    valid_resource_types = ResourceType.get_valid_values()

    if resource_type not in valid_resource_types:
        raise ValueError("Permissions cannot be manipulated for a resource of type: %s" % (resource_type))

    return resource_db
예제 #2
0
파일: rbac.py 프로젝트: ssubbanna/st2_test
def _validate_resource_type(resource_db):
    """
    Validate that the permissions can be manipulated for the provided resource type.
    """
    resource_type = resource_db.get_resource_type()
    valid_resource_types = ResourceType.get_valid_values()

    if resource_type not in valid_resource_types:
        raise ValueError('Permissions cannot be manipulated for a resource of type: %s' %
                         (resource_type))

    return resource_db