Documentation
¶
Index ¶
- Constants
- Variables
- func NewClient(config *ClientConfig, logger log.Logger) (*client, error)
- func NewProvider(typeName string, logger log.Logger) *provider
- func NewShieldNewClient(config *ClientConfig, logger log.Logger) (*shieldNewclient, error)
- type ClientConfig
- type Config
- type Credentials
- type DeleteRelation
- type Group
- type GroupRelation
- type HTTPClient
- type Metadata
- type Organization
- type Permission
- type Project
- type Relation
- type ShieldClient
- type User
Constants ¶
View Source
const ( RoleMember = "users" RoleAdmin = "admins" AccountTypeUser = "user" )
View Source
const ( ResourceTypeTeam = "team" ResourceTypeProject = "project" ResourceTypeOrganization = "organization" )
Variables ¶
View Source
var ( ErrInvalidPermissionConfig = errors.New("invalid permission config type") ErrInvalidResourceType = errors.New("invalid resource type") )
Functions ¶
func NewProvider ¶
func NewShieldNewClient ¶ added in v0.12.7
func NewShieldNewClient(config *ClientConfig, logger log.Logger) (*shieldNewclient, error)
Types ¶
type ClientConfig ¶
type ClientConfig struct {
Host string `validate:"required,url" mapstructure:"host"`
AuthHeader string `validate:"required" mapstructure:"auth_header"`
AuthEmail string `validate:"required" mapstructure:"auth_email"`
HTTPClient HTTPClient
}
type Config ¶
type Config struct {
ProviderConfig *domain.ProviderConfig
// contains filtered or unexported fields
}
func NewConfig ¶
func NewConfig(pc *domain.ProviderConfig) *Config
func (*Config) ParseAndValidate ¶
type Credentials ¶
type Credentials struct {
Host string `json:"host" mapstructure:"host" validate:"required"`
AuthHeader string `json:"auth_header" mapstructure:"auth_header" validate:"required"`
AuthEmail string `json:"auth_email" mapstructure:"auth_email" validate:"required"`
ClientVersion string `json:"client_version" mapstructure:"client_version"`
}
type DeleteRelation ¶ added in v0.12.7
type Group ¶ added in v0.12.7
type Group struct {
ID string `json:"id" mapstructure:"id"`
Name string `json:"name" mapstructure:"name"`
Slug string `json:"slug" mapstructure:"slug"`
OrgId string `json:"orgId" mapstructure:"orgId"`
Metadata Metadata `json:"metadata" mapstructure:"metadata"`
Admins []string `json:"admins" mapstructure:"admins"`
}
type GroupRelation ¶ added in v0.12.7
type Organization ¶
type Organization struct {
ID string `json:"id" mapstructure:"id"`
Name string `json:"name" mapstructure:"name"`
Slug string `json:"slug" mapstructure:"slug"`
Admins []string `json:"admins" mapstructure:"admins"`
}
func (*Organization) FromDomain ¶
func (o *Organization) FromDomain(r *domain.Resource) error
func (*Organization) ToDomain ¶
func (o *Organization) ToDomain() *domain.Resource
type Permission ¶
type Permission string
type Project ¶
type Relation ¶ added in v0.12.7
type Relation struct {
Id string `json:"id" mapstructure:"id"`
ObjectId string `json:"object_id" mapstructure:"object_id"`
ObjectNamespace string `json:"object_namespace" mapstructure:"object_namespace"`
Subject string `json:"subject" mapstructure:"subject"`
RoleName string `json:"role_name" mapstructure:"role_name"`
}
type ShieldClient ¶
type ShieldClient interface {
GetGroups(ctx context.Context) ([]*Group, error)
GetProjects(ctx context.Context) ([]*Project, error)
GetOrganizations(ctx context.Context) ([]*Organization, error)
GrantGroupAccess(ctx context.Context, team *Group, userId string, role string) error
RevokeGroupAccess(ctx context.Context, team *Group, userId string, role string) error
GrantProjectAccess(ctx context.Context, project *Project, userId string, role string) error
RevokeProjectAccess(ctx context.Context, project *Project, userId string, role string) error
GrantOrganizationAccess(ctx context.Context, organization *Organization, userId string, role string) error
RevokeOrganizationAccess(ctx context.Context, organization *Organization, userId string, role string) error
GetSelfUser(ctx context.Context, email string) (*User, error)
}
Click to show internal directories.
Click to hide internal directories.