예제 #1
0
def user(user_password):
    user = User(username="******")
    user.set_password(user_password)
    user.save()

    yield user
    user.delete()
예제 #2
0
def user_admin(user_admin_role):
    role_assignment = RoleAssignment(role=user_admin_role,
                                     domain={"scope": "Global"})
    user = User(username="******")
    user.set_password("password")
    user.role_assignments = [role_assignment]
    user.save()

    yield user
    user.delete()
예제 #3
0
    def user_token(self):
        user = User(username="******").save()
        user_token = UserToken(
            expires_at=datetime.utcnow() + timedelta(minutes=10),
            user=user,
            uuid=uuid4(),
        ).save()

        yield user_token
        user_token.delete()
        user.delete()
예제 #4
0
def user_with_permission(event_forward_role):
    role_assignment = RoleAssignment(
        role=event_forward_role,
        domain={
            "scope": "Global",
        },
    )

    user = User(username="******", role_assignments=[role_assignment]).save()

    yield user
    user.delete()
예제 #5
0
def user_with_role_assignments():
    role = Role(name="assignedrole1", permissions=["garden:read"]).save()
    role_assignment = RoleAssignment(domain={
        "scope": "Garden",
        "identifiers": {
            "name": "garden1"
        }
    },
                                     role=role)
    user = User(username="******", role_assignments=[role_assignment]).save()

    yield user
    user.delete()
    role.delete()
예제 #6
0
def user_with_permission(garden, garden_admin_role):
    role_assignment = RoleAssignment(
        role=garden_admin_role,
        domain={
            "scope": "Garden",
            "identifiers": {
                "name": garden.name
            },
        },
    )

    user = User(username="******", role_assignments=[role_assignment]).save()

    yield user
    user.delete()
예제 #7
0
def user_with_permission(garden_permitted, queue_manager_role):
    role_assignment = RoleAssignment(
        role=queue_manager_role,
        domain={
            "scope": "Garden",
            "identifiers": {
                "name": garden_permitted.name,
            },
        },
    )

    user = User(username="******", role_assignments=[role_assignment]).save()

    yield user
    user.delete()
예제 #8
0
def user(request_permitted, operator_role):
    role_assignment = RoleAssignment(
        role=operator_role,
        domain={
            "scope": "System",
            "identifiers": {
                "name": request_permitted.system,
                "namespace": request_permitted.namespace,
            },
        },
    )

    user = User(username="******", role_assignments=[role_assignment]).save()

    yield user
    user.delete()
예제 #9
0
def user_with_role_assignments(
    role_assignment_for_garden_scope,
    role_assignment_for_system_scope,
    role_assignment_for_global_scope,
):
    user = User(
        username="******",
        role_assignments=[
            role_assignment_for_garden_scope,
            role_assignment_for_system_scope,
            role_assignment_for_global_scope,
        ],
    ).save()

    yield user
    user.delete()
예제 #10
0
def user(system_permitted, system_read_role):
    role_assignment = RoleAssignment(
        role=system_read_role,
        domain={
            "scope": "System",
            "identifiers": {
                "name": system_permitted.name,
                "namespace": system_permitted.namespace,
            },
        },
    )

    user = User(username="******", role_assignments=[role_assignment]).save()

    yield user
    user.delete()
예제 #11
0
    def existing_user(self):
        user = User(username="******").save()

        yield user
        user.delete()
예제 #12
0
    def user(self, role_assignment):
        user = User(username="******",
                    role_assignments=[role_assignment]).save()

        yield user
        user.delete()
예제 #13
0
def user_without_permission():
    user = User(username="******").save()

    yield user
    user.delete()
예제 #14
0
def user_without_permission(event_forward_role):
    user = User(username="******").save()

    yield user
    user.delete()