Skip to content

Refactor for_agent / clear up API usage #623

Closed
@joepio

Description

@joepio

Authorization in atomic_lib is done by passing a for_agent to much of the get_x type functions. When None is passed, we don't perform any rights checks. This behavior might be confusing to new users of atomic_lib, as they might assume that None means the public agent should be checked.

I think we have two options to improve this:

Use one type, improve documentation

Add a ForAgent type, and explain carefully how that works (see above).

We still have the issue that an atomic_lib user might screw up and leak data if they accidentally pass None while they mean public_agent.

Use a URL that represents sudo agent

Similar to urls::PUBLIC_AGENT, we add a urls::SUDO_AGENT. Whenever an atomic_lib user wants to perform some query, they can use this URL.

Unfortunately, this seems a lot more verbose and annoying to use.

Create an enum ForAgent

Is structured, clear... Seems like the way to go!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions