luci: go.chromium.org/luci/server/auth/authdb/internal/realmset Index | Files

package realmset

import "go.chromium.org/luci/server/auth/authdb/internal/realmset"

Package realmset provides queryable representation of LUCI Realms DB.

Used internally by authdb.Snapshot.

Index

Package Files

realmset.go

Constants

const ExpectedAPIVersion = 1

ExpectedAPIVersion is the supported value of api_version field.

See Build implementation for details.

type PermissionIndex Uses

type PermissionIndex uint32

PermissionIndex is used in place of permission names.

Note: should match an int type used in `permissions` field in the proto.

type Realms Uses

type Realms struct {
    // contains filtered or unexported fields
}

Realms is a queryable representation of realms.Realms proto.

func Build Uses

func Build(r *protocol.Realms, qg *graph.QueryableGraph) (*Realms, error)

Build constructs Realms from the proto message and the group graph.

func (*Realms) HasRealm Uses

func (r *Realms) HasRealm(realm string) bool

HasRealm returns true if the given realm exists in the DB.

func (*Realms) PermissionIndex Uses

func (r *Realms) PermissionIndex(perm realms.Permission) (idx PermissionIndex, ok bool)

PermissionIndex returns an index of the given permission.

It can be passed to QueryAuthorized. Returns (0, false) if there's no such permission in the Realms DB.

func (*Realms) QueryAuthorized Uses

func (r *Realms) QueryAuthorized(realm string, perm PermissionIndex) (graph.SortedNodeSet, stringset.Set)

QueryAuthorized returns a representation of principals that have the requested permission in the given realm.

The permission should be given as its index obtained via PermissionIndex.

The realm name is not validated. Unknown or invalid realms are silently treated as empty. No fallback to @root happens.

Returns a set of groups with principals that have the permission and a set of identity strings that were specified in the realm ACL directly (not via a group). nils are used in place of empty sets.

The set of groups is represented by a sorted slice of group indexes in a graph.QueryableGraph which was passed to Build().

Package realmset imports 6 packages (graph) and is imported by 2 packages. Updated 2020-05-30. Refresh now. Tools for package owners.