rolestore

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 11, 2020 License: Apache-2.0 Imports: 2 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	Enabled   bool   `json:"enabled"`
	BlockRole bool   `json:"block_role"`
	StartTime string `json:"start_time"`
	EndTime   string `json:"end_time"`
	Timezone  string `json:"timezone"`
}

Context defines the context information for a role.

type Role

type Role struct {
	ID          string     `json:"id"`
	Name        string     `json:"name"`
	Explicit    bool       `json:"explicit" tabulate:"@userCtx"`
	Implicit    bool       `json:"implicit" tabulate:"@userCtx"`
	System      bool       `json:"system"`
	GrantType   string     `json:"grant_type"`
	Comment     string     `json:"comment"`
	SourceRule  SourceRule `json:"source_rules"`
	Permissions []string   `json:"permissions"`
	Context     *Context   `json:"context"`
	MemberCount int        `json:"member_count"`
	PublicKey   []string   `json:"principal_public_key_strings,omitempty"`
}

Role contains PrivX role information.

type RoleRef

type RoleRef struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

RoleRef is a reference to role object

type RoleStore

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

RoleStore is a role-store client instance.

func New

func New(api restapi.Connector) *RoleStore

New creates a new role-store client instance, using the argument SDK API client.

func (*RoleStore) AddUserRole

func (store *RoleStore) AddUserRole(userID, roleID string) error

AddUserRole adds the specified role for the user. If the user already has the role, this function does nothing.

func (*RoleStore) CreateRole

func (store *RoleStore) CreateRole(role Role) (string, error)

CreateRole creates new role

func (*RoleStore) GetRoleMembers

func (store *RoleStore) GetRoleMembers(id string) ([]User, error)

GetRoleMembers gets all members (users) of the argument role ID.

func (*RoleStore) RemoveUserRole

func (store *RoleStore) RemoveUserRole(userID, roleID string) error

RemoveUserRole removes the specified role from the user. If the user does not have the role, this function does nothing.

func (*RoleStore) ResolveRoles

func (store *RoleStore) ResolveRoles(names []string) ([]RoleRef, error)

ResolveRoles searches give role name and returns corresponding ids

func (*RoleStore) Role

func (store *RoleStore) Role(id string) (role *Role, err error)

Role gets information about the argument role ID.

func (*RoleStore) Roles

func (store *RoleStore) Roles() ([]Role, error)

Roles gets all configured roles.

func (*RoleStore) SearchUsers

func (store *RoleStore) SearchUsers(keywords, source string) ([]User, error)

SearchUsers searches for users, matching the keywords and source criteria.

func (*RoleStore) User

func (store *RoleStore) User(id string) (user *User, err error)

User gets information about the argument user ID.

func (*RoleStore) UserRoles

func (store *RoleStore) UserRoles(id string) ([]Role, error)

UserRoles gets the roles of the argument user ID.

type SourceRule

type SourceRule struct {
	Type    string       `json:"type"`
	Match   string       `json:"match"`
	Source  string       `json:"source,omitempty"`
	Pattern string       `json:"search_string,omitempty"`
	Rules   []SourceRule `json:"rules"`
}

SourceRule defines a mapping of role to object objects in directory

func SourceRuleNone

func SourceRuleNone() SourceRule

SourceRuleNone creates an empty mapping source for the role

type User

type User struct {
	ID                string   `json:"id"`
	SourceUserID      string   `json:"source_user_id"`
	Tags              []string `json:"tags"`
	Principal         string   `json:"principal"`
	Source            string   `json:"source"`
	FullName          string   `json:"full_name"`
	Email             string   `json:"email"`
	DistinguishedName string   `json:"distinguished_name"`
	Roles             []Role   `json:"roles"`
}

User contains PrivX user information.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL