rebar3_hex_organization (rebar3_hex v7.5.0)

View Source

rebar3_hex_organization - Manage organizations

Manages the list of authorized hex organizations.

Note that all commands that require a NAME argument expect a qualified repository name for the argument (i.e., hexpm:my_org).

About Organizations

Organizations are feature provided by hexpm that allows you group packages, public and private alike. Organizations are treated as repositories that have a parent. The parent is found as the first part of a repository's name, separated from the organization by a :. So for the organization your_org on the main repository hexpm the fully qualified name would be hexpm:your_org.

Be sure to add your organization to either your global rebar.config ~/.config/rebar3/rebar.config or within an projects rebar.config. Below is an example:

  {hex, [{repos, [ #{name => <<"hexpm:your_org">>}]}]}.

Authorize an organization

By default you will be authorized to all your organizations when running rebar3 hex user auth and this is the recommended approach. This command is mainly provided for CI and build systems where access to an organization is needed without authorizing a user.

For CI, generate an organization key with rebar3 hex organization key NAME generate and pass it with rebar3 hex organization auth NAME --key KEY.

Deprecation: Authorizing an organization without --key is deprecated and will be removed. It creates a user key tied to your account; use rebar3 hex user auth for development instead, or pass a pre-generated organization key with --key for CI.

  $ rebar3 hex organization auth NAME  [--key KEY] [--key-name KEY_NAME]

Deauthorize and remove an organization

  $ rebar3 hex organization deauth NAME

List all authorized organizations

This command will only list organizations you have authorized with this task, it will not list organizations you have access to by having authorized with rebar3 hex user auth.

Generate organization key

This command is useful to pre-generate keys for use with rebar3 hex organization auth NAME --key KEY on CI servers or similar systems. It returns the hash of the generated key that you can pass to auth NAME --key KEY. Unlike the hex user key commands, a key generated with this command is owned by the organization directly, and not the user that generated it. This makes it ideal for shared environments such as CI where you don't want to give access to user-specific resources and the user's organization membership status won't affect key. By default this command sets the organization permission which allows read-only access to the organization, it can be overridden with the --permission flag.

  $ rebar3 hex organization key NAME generate [--key-name KEY_NAME] [--permission PERMISSION]

Revoke key

Removes a given key from a organization.

  $ rebar3 hex organization key NAME revoke KEY_NAME

List keys

Lists all keys associated with the organization.

  $ rebar3 hex organization key NAME list

Command line options

  • --all - Used for revoking all keys for authorized organization. Only valid with the revoke` task.</li> <li>`--key KEY - Hash of key used to authenticate HTTP requests to organization, if omitted will generate a new key with your account credentials. This flag is useful if you have a key pre-generated with rebar3 hex organization key and want to authenticate on a CI server or similar system. Omitting --key is deprecated; authenticate as a user with rebar3 hex user auth instead.

  • --key-name KEY_NAME - By default Hex will base the key name on your machine's hostname and the organization name, use this option to give your own name.

  • --permission PERMISSION - Sets the permissions on the key, this option can be given multiple times, possibly values are:

    • api:read - API read access.
    • api:write - API write access.
    • repository - Access to the repository (this is the default permission).