role

package
v0.0.0-...-284eadf Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2017 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IdentityRoleFilterByID

func IdentityRoleFilterByID(identityRoleID uuid.UUID) func(db *gorm.DB) *gorm.DB

IdentityRoleFilterByID is a gorm filter for Identity Role ID.

Types

type GormIdentityRoleRepository

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

GormIdentityRoleRepository is the implementation of the storage interface for IdentityRole.

func (*GormIdentityRoleRepository) CheckExists

func (m *GormIdentityRoleRepository) CheckExists(ctx context.Context, id string) error

CheckExists returns nil if the given ID exists otherwise returns an error

func (*GormIdentityRoleRepository) Create

Create creates a new record.

func (*GormIdentityRoleRepository) Delete

func (m *GormIdentityRoleRepository) Delete(ctx context.Context, id uuid.UUID) error

Delete removes a single record.

func (*GormIdentityRoleRepository) List

List returns all identity roles

func (*GormIdentityRoleRepository) Load

func (m *GormIdentityRoleRepository) Load(ctx context.Context, id uuid.UUID) (*IdentityRole, error)

Load returns a single IdentityRole as a Database Model This is more for use internally, and probably not what you want in your controllers

func (*GormIdentityRoleRepository) Save

Save modifies a single record

func (*GormIdentityRoleRepository) TableName

func (m *GormIdentityRoleRepository) TableName() string

TableName overrides the table name settings in Gorm to force a specific table name in the database.

type GormRoleRepository

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

GormRoleRepository is the implementation of the storage interface for Role.

func (*GormRoleRepository) AddScope

func (*GormRoleRepository) CheckExists

func (m *GormRoleRepository) CheckExists(ctx context.Context, id string) (bool, error)

CheckExists returns nil if the given ID exists otherwise returns an error

func (*GormRoleRepository) Create

func (m *GormRoleRepository) Create(ctx context.Context, u *Role) error

Create creates a new record.

func (*GormRoleRepository) Delete

func (m *GormRoleRepository) Delete(ctx context.Context, id uuid.UUID) error

Delete removes a single record.

func (*GormRoleRepository) List

func (m *GormRoleRepository) List(ctx context.Context) ([]Role, error)

List returns all roles

func (*GormRoleRepository) ListScopes

func (*GormRoleRepository) Load

func (m *GormRoleRepository) Load(ctx context.Context, id uuid.UUID) (*Role, error)

Load returns a single Role as a Database Model This is more for use internally, and probably not what you want in your controllers

func (*GormRoleRepository) Save

func (m *GormRoleRepository) Save(ctx context.Context, model *Role) error

Save modifies a single record

func (*GormRoleRepository) TableName

func (m *GormRoleRepository) TableName() string

TableName overrides the table name settings in Gorm to force a specific table name in the database.

type IdentityRole

type IdentityRole struct {
	gormsupport.Lifecycle

	// This is the primary key value
	IdentityRoleID uuid.UUID `sql:"type:uuid default uuid_generate_v4()" gorm:"primary_key" gorm:"column:identity_role_id"`
	// The identity to which the role is assigned
	Identity account.Identity
	// The resource to which the role is applied
	Resource resource.Resource
	// The role that is assigned
	Role Role
}

func (IdentityRole) GetLastModified

func (m IdentityRole) GetLastModified() time.Time

GetLastModified returns the last modification time

func (IdentityRole) TableName

func (m IdentityRole) TableName() string

TableName overrides the table name settings in Gorm to force a specific table name in the database.

type IdentityRoleRepository

type IdentityRoleRepository interface {
	repository.Exister
	Load(ctx context.Context, ID uuid.UUID) (*IdentityRole, error)
	Create(ctx context.Context, u *IdentityRole) error
	Save(ctx context.Context, u *IdentityRole) error
	List(ctx context.Context) ([]IdentityRole, error)
	Delete(ctx context.Context, ID uuid.UUID) error
}

IdentityRoleRepository represents the storage interface.

func NewIdentityRoleRepository

func NewIdentityRoleRepository(db *gorm.DB) IdentityRoleRepository

NewIdentityRoleRepository creates a new storage type.

type Role

type Role struct {
	gormsupport.Lifecycle

	// This is the primary key value
	RoleID uuid.UUID `sql:"type:uuid default uuid_generate_v4()" gorm:"primary_key" gorm:"column:role_id"`
	// The resource type that this role applies to
	ResourceType resource.ResourceType `gorm:"ForeignKey:ResourceTypeID;AssociationForeignKey:ResourceTypeID"`
	// The foreign key value for ResourceType
	ResourceTypeID uuid.UUID
	// The name of this role
	Name string
}

func (Role) GetLastModified

func (m Role) GetLastModified() time.Time

GetLastModified returns the last modification time

func (Role) TableName

func (m Role) TableName() string

TableName overrides the table name settings in Gorm to force a specific table name in the database.

type RoleRepository

type RoleRepository interface {
	CheckExists(ctx context.Context, id string) (bool, error)
	Load(ctx context.Context, ID uuid.UUID) (*Role, error)
	Create(ctx context.Context, u *Role) error
	Save(ctx context.Context, u *Role) error
	List(ctx context.Context) ([]Role, error)
	Delete(ctx context.Context, ID uuid.UUID) error

	ListScopes(ctx context.Context, u *Role) ([]resource.ResourceTypeScope, error)
	AddScope(ctx context.Context, u *Role, s *resource.ResourceTypeScope) error
}

RoleRepository represents the storage interface.

func NewRoleRepository

func NewRoleRepository(db *gorm.DB) RoleRepository

NewRoleRepository creates a new storage type.

type RoleScope

type RoleScope struct {
	gormsupport.Lifecycle

	RoleID uuid.UUID `sql:"type:uuid" gorm:"primary_key" gorm:"column:role_ID"`

	Scope   resource.ResourceTypeScope `gorm:"ForeignKey:ScopeID;AssociationForeignKey:ResourceTypeScopeID"`
	ScopeID uuid.UUID                  `sql:"type:uuid" gorm:"primary_key" gorm:"column:role_ID"`
}

func (RoleScope) GetLastModified

func (m RoleScope) GetLastModified() time.Time

GetLastModified returns the last modification time

func (RoleScope) TableName

func (m RoleScope) TableName() string

Jump to

Keyboard shortcuts

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