models

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2022 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DomainScopeOperation = DOMAINSCOPEOPERATION{
	CreateTicket: "createTicket",
	DeleteTicket: "deleteTicket",
	CreateDomain: "createDomain",
	DeleteDomain: "deleteDomain",
}
View Source
var KmsOperation = KMSOPERATION{
	Encrypt: "encrypt",
	Decrypt: "decrypt",
}
View Source
var Operation = OPERATION{
	Create:    "create",
	Delete:    "delete",
	AddMember: "addMember",
	DelMember: "delMember",
	List:      "list",
	Show:      "show",
	Info:      "info",
	SetSecret: "setSecret",
	GetSecret: "getSecret",
}

Functions

This section is empty.

Types

type Aperms

type Aperms struct {
	Group        map[string]bool
	Domain       map[string]bool
	Ticket       map[string]bool
	SecretTicket map[string]bool
}

type AwsAssumeRole

type AwsAssumeRole struct {
	RoleArn string `json:"roleArn"`
	Ttl     int32  `json:"ttl"`
}

type AwsPermissions

type AwsPermissions struct {
	Effect   string   `json:"effect"`
	Action   []string `json:"action"`
	Resource string   `json:"resource"`
}

type BannedUser

type BannedUser struct {
	UserEmail string `json:"userEmail"`
	Details   string `json:"details"`
	CreatedAt string `json:"createdAt"`
	CreatedBy string `json:"createdBy"`
	UpdatedAt string `json:"updatedAt"`
	UpdatedBy string `json:"updatedBy"`
}

type DBLayer

type DBLayer interface {
	// GetTickets() ([]Ticket, error)
	// GetGroups() ([]TicketGroup, error)
	// Usable() bool
	DBType() string

	// Ban Table
	AddBannedUser(bannedUser BannedUser) error
	GetBannedUsers() ([]BannedUser, error)
	GetBannedUserByEmail(userEmail string) (BannedUser, error)
	UnbanUser(userEmail string) error

	// Session Table
	CreateSession(session *Session) error
	UpdateSession(prevToken string,
		currentToken string,
		currentTokenExpires int64,
		refreshToken string,
	) bool
	DeleteSession(sessionID string, epoch int64) error
	GetSessionByRefreshToken(refreshToken string) (Session, error)
	GetSessions(scanType string) ([]Session, error)
	GetSessionByToken(token string) (Session, error)
	GetSessionsByEmail(email string) ([]Session, error)

	// Group Table
	GetAllGroups() ([]TicketGroup, error)
	GetGroup(groupName string) (TicketGroup, error)
	CreateGroup(group TicketGroup) error
	DeleteGroup(groupName string) error
	DoesGroupExist(groupName string) bool
	IsUserInTikiadmins(userEmail string) bool
	GetGroupMembers(groupName string) ([]string, error)
	IsUserMemberOfGroup(member string, groupName string) bool
	CanUserPerformGroupOperation(userEmail string, operation string) bool
	GetGroupNamesOfUser(userEmail string) ([]string, error)
	GetGroupsOfUser(userEmail string) ([]TicketGroup, error)
	CanUserAccessToTicket(userEmail string, ticketPath string) bool
	AddMemberToGroup(newMember string, groupName string, changedBy string) error
	DelMemberFromGroup(memberToDelete string, groupName string, changedBy string) error

	// Ticket Table
	GetAllTickets() ([]Ticket, error)
	QueryTicketByPath(ticketPath string) (Ticket, error)
	DoesTicketExist(ticketPath string) bool
	CreateTicket(ticket Ticket) error
	DeleteTicket(ticketPath string, ticketType string) error
	IsUserAllowedByDomainScope(userEmail string, ticketOrDomainPath string, domainScopeOperation string) bool
	SetTicketSecret(ticketPath string, secretData string) error
	GetTicketSecret(ticketPath string) (string, error)
	CanUserPerformTicketOperation(userEmail string, operationType string) bool

	// Domain Table
	CanUserPerformDomainOperation(userEmail string, operation string) bool
	DoesTicketDomainExist(ticketDomainPath string) bool
	GetAllDomains() ([]TicketDomain, error)
	GetDomain(domainPath string) (TicketDomain, error)
	CreateDomain(domain TicketDomain) error
	DeleteDomain(domainPath string) error
	IsUserBanned(userEmail string) bool
}

type DOMAINSCOPEOPERATION

type DOMAINSCOPEOPERATION struct {
	CreateTicket string
	DeleteTicket string
	CreateDomain string
	DeleteDomain string
}

type DScope

type DScope struct {
	Root string `json:"root"`
	Info string `json:"info"`
}

type K8sDetails

type K8sDetails struct {
	Server  string `json:"server"`
	Cluster string `json:"cluster"`
	User    string `json:"user"`
	Name    string `json:"name"`
}

type KMSOPERATION

type KMSOPERATION struct {
	Encrypt string
	Decrypt string
}

type OPERATION

type OPERATION struct {
	Create    string
	Delete    string
	AddMember string
	DelMember string
	Show      string
	Info      string
	List      string
	SetSecret string
	GetSecret string
}

type Session

type Session struct {
	SessID       string `json:"sessId"`
	SessionOwner string `json:"sessionOwner"`
	AccessToken  string `json:"accessToken"`
	IdToken      string `json:"idToken"`
	Expire       string `jspn:"expire"`
	RefreshToken string `json:"refreshToken"`
	TokenType    string `json:"tokenType"`
	UserInfo     struct {
		Id            string `json:"id"`
		Email         string `json:"email"`
		VerifiedEmail string `json:"verifiedEmail"`
		Picture       string `json:"picture"`
		Hd            string `json:"hd"`
	}
	Epoch           int64  `json:"epoch"`
	SessionExpEpoch int64  `json:"sessionExpEpoch"`
	PreviousIdToken string `json:"prevIdToken"`
	Details         string `json:"details"`
	Rtimes          int    `json:"rTimes,default:1"`
	IsRevoked       bool   `json:"isRevoked,default:false"`
}

type SessionExpose

type SessionExpose struct {
	SessionId       string `json:"sessionId"`
	SessionOwner    string `json:"sessionOwner"`   //  email
	SessionDetails  string `json:"sessionDetails"` // comment
	ExpiresAt       string `json:"expiresAt"`
	Epoch           int64  `json:"epoch"`
	SessionExpEpoch int64  `json:"sessionExpEpoch"`
	RefreshCount    int    `json:"refreshCount"`
	Revoked         bool   `json:"revoked"`
}

type Ticket

type Ticket struct {
	TicketPath       string         `json:"ticketPath"`
	TicketType       string         `json:"ticketType"`
	TicketInfo       string         `json:"ticketInfo"`
	TicketRegion     string         `json:"ticketRegion"`
	AwsAssumeRole    AwsAssumeRole  `json:"assumeRoleDetails,omitempty"`
	AwsPermissions   AwsPermissions `json:"awsPermissions,omitempty"`
	OwnersGroup      []string       `json:"ownersGroup,omitempty"`
	SecretData       string         `json:"secretData,omitempty"`
	SourceAddresses  []string       `json:"sourceAddress,omitempty"`
	SAccountPassword string         `json:"sAccountPassword,omitempty"`
	K8sDetails       K8sDetails     `json:"k8sDetails"`
	CreatedAt        string         `json:"createdAt"`
	CreatedBy        string         `json:"createdBy"`
	UpdatedAt        string         `json:"updatedAt"`
	UpdatedBy        string         `json:"updatedBy"`
}

type TicketDomain

type TicketDomain struct {
	DomainPath    string `json:"domainPath"`
	OwnerGroup    string `json:"ownerGroup"`
	Parent        string `json:"parent"`
	DomainComment string `json:"domainComment"`
	CreatedAt     int64  `json:"createdAt"`
	CreatedBy     string `json:"createdBy"`
	UpdatedAt     int64  `json:"updatedAt"`
	UpdatedBy     string `json:"updatedBy"`
}

type TicketGroup

type TicketGroup struct {
	GroupName    string   `json:"groupName"`
	GroupMembers []string `json:"groupMembers"`
	InUseBy      []string `json:"inUseBy,omitempty"`
	CreatedAt    int64    `json:"createdAt,omitempty"`
	CreatedBy    string   `json:"createdBy,omitempty"`
	UpdatedAt    int64    `json:"updatedAt,omitempty"`
	UpdatedBy    string   `json:"updatedBy,omitempty"`
	AccessPerms  Aperms   `json:"accessPerms,omitempty"`
	DomainScope  DScope   `json:"domainScope"`
}

Jump to

Keyboard shortcuts

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