Organizations

Organize your organization's structure

Luna enables creating hierarchical organization account structures, allowing you to establish a framework with one or more administrators and multiple users within your organization. You can assign access tokens for quantum hardware at the organizational level, ensuring that users can use the hardware, but don't possess the authority to view, modify, or delete the tokens. Admins are able to manage user privileges, including adding or removing users, as well as assigning or revoking administrative roles.

To associate an organization with your account and attain administrative privileges, please get in contact with us. Once you have obtained administrative access to your organization, you can start adding user accounts and overseeing user roles.

# Load the luna package
from luna_sdk import LunaSolve
from luna_sdk.schemas.user import User

# Create a Luna object and set your credentials
luna = LunaSolve(email="YOUREMAIL", password="YOURPASSWORD")

# Define the email address, given name and family name of the user to add
email = 'user@example.com'
given_name = 'User'
family_name = 'Example'

# Add the specified user to your organization
user: User = luna.organization.add_user(email=email, given_name=given_name, family_name=family_name)

# Assign the admin role to the new user
user: User = luna.organization.assign_admin(email=email)

# Remove the admin role from the new user
user: User = luna.organization.revoke_admin(email=email)

# Remove the user from your organization
luna.organization.delete_user(email=email)

You can get an overview of a specific user and all current users in your organization at any time:

from typing import List

# View a specific user of your organization
user: User = luna.organization.get_user(email=email)

# View all users of your organization
users: List[User] = luna.organization.get_users()

Your organization can be used to add access tokens to quantum hardware without your users being able to access the token themselves:

from luna_sdk.schemas.enums.qpu_provider import QpuProviderEnum
from luna_sdk.schemas.enums.qpu_token_type import QpuTokenTypeEnum
from luna_sdk.schemas.qpu_token import QpuToken

# Create your organization's QPU token
qpu_token = luna.qpu_token.create_qpu_token(
    name="TokenName", 
    provider=QpuProviderEnum.dwave, 
    token="QPUToken",
    token_type=QpuTokenTypeEnum.PERSONAL
)

You can always get a list of the tokens of your organization:

from typing import List

# Get your organization's QPU tokens
tokens= luna.qpu_token.get_qpu_tokens()

# Get your organization's QPU tokens from only D-Wave Systems
tokens = luna.qpu_token.get_qpu_tokens(
  filter_qpu_provider=QpuProviderEnum.dwave
)

You can also rename any of the tokens:

# Access one of your organization's QPU tokens
token_to_rename = tokens[0]

# Rename the token
token_renamed = luna.qpu_token.update_qpu_token(
  qpu_token_id=token_to_rename.id, 
  name="NewTokenName"
)

And, finally, if you don't want a token to be stored in your organization any more, you can remove any tokens you don't need:

# Delete a specific token. Use with caution!
luna.qpu_token.delete_qpu_token(qpu_token_id=qpu_token.id)

Was this page helpful?