-
Notifications
You must be signed in to change notification settings - Fork 2
API
Perm's API revolves around the question of who can perform what, where.
Perm answers this question a few ways, depending on what information is available, e.g. it can answer ...
- Whether a given actor can perform some action on a resource.
- For which resources the actor can perform an action.
In addition, Perm provides administrative functionality to maintain administrative state.
The subject that is granted or denied a permission
. It may correspond to either a human or machine user of another system.
-
id
(string): The actor's external identifier, e.g., their OIDC subject identifier -
namespace
(string): A unique identifier for the authentication server responsible for managing the actor's identity, e.g., the OIDC issuer identifier
- Perm is not responsible for authentication or maintaining identity state. The client is responsible for determining and validating an actor's identity.
A collection of actor
s, such as the members of a team, that should all maintain the same subset of roles so that their permissions can easily stay in sync.
-
id
(string): The group's external identifier
- Perm is not responsible for maintaining group membership state. The client is responsible for providing the list of groups associated with a particular actor. (This may change in the future.)
- The group properties are likely to change, e.g., a
namespace
field may get added
A description of what action an actor
can perform, for which resource.
-
action
(string): The verb describing the restriction, usually tied to a particular resource type, e.g.,repository.read
-
resource pattern (string)
: The particular resource or set of resources to which the restriction applies, e.g.,alices-secret
orbobs-burgers/*
- Perm does not currently support any meaningful interpretation of resource patterns, e.g., wildcards
A collection of permission
s that multiple actor
s and group
s may be assigned to. Roles are intended to abstract permission management away from subjects, such that, e.g., permissions may be synchronized more easily across members of a particular team or department.
-
name
(string): A unique name identifying the role
All responses return gRPC status response codes. In particular, you may expect Perm to respond with:
-
0 OK
: The response succeeded -
3 INVALID_ARGUMENT
: The request contains at least one invalid argument -
4 DEADLINE_EXCEEDED
: The response took too long -
5 NOT_FOUND
: The requested resource does not exist or the caller is not permitted to read it -
6 ALREADY_EXISTS
: The requested resource already exists -
7 PERMISSION_DENIED
: The caller is authenticated but not permitted to perform the request -
16 UNAUTHENTICATED
: The request requires authentication but the caller is not identified
Create a new role
.
-
name
(string): The name of the new role -
permission
([]Permission): The list ofpermissions
s that members of the role will be allowed to perform
-
role
(Role): The newly createdrole
-
already exists
: A role with the requested name already exists
Delete a role
.
-
name
(string): The name of the new role
empty body
-
not found
: No role with the specified name exists
-
actor
(Actor): Theactor
being assigned to the role -
role_name
(string): The name of the role to which the actor should be assigned
empty body
-
not found
: No role with the specified name exists -
already exists
: The actor is already assigned to the role
-
group
(Group): Thegroup
being assigned to the role -
role_name
(string): The name of the role to which the group should be assigned
empty body
-
not found
: No role with the specified name exists -
already exists
: The group is already assigned to the role
Unassign an actor
from a role
.
-
actor
(Actor): Theactor
being unassigned the role -
role_name
(string): The name of the role from which the actor should be unassigned
empty body
-
not found
: No role with the specified name exists, or the role exists but the actor is not assigned to it
-
group
(Group): Thegroup
being unassigned from the role -
role_name
(string): The name of the role from which the group should be unassigned
empty body
-
not found
: No role with the specified name exists, or the role exists but the group is not assigned to it
Check whether an actor
, given a set of group
memberships, has a particular permission
.
-
actor
(Actor) -
action
(string) -
resource
(string) -
groups
([]Group)
-
has_permission
(bool): Whether or not the actor, as a member of the specified groups, is permitted to perform the action on the resource
- Perm can only match resources to permission resource patterns exactly, e.g., it cannot determine that
/foo/bar
matches the glob/foo/*
. This may change in the future.
List the resource patterns on which an actor
can perform a particular action
-
actor
(Actor) -
action
(string) -
groups
([]Group)
-
resource_patterns
([]string)
Perm's gRPC API may be used directly from the language of your choice, so long as it is supported by gRPC and protocol buffers. You may compile a language-specific client using protoc.
We also currently provide SDKs for the following languages: