project

package
v2.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2019 License: GPL-3.0 Imports: 8 Imported by: 21

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CasePermissions added in v1.0.0

type CasePermissions struct {
	CreateCase    bool
	EditCase      bool
	DeleteCase    bool
	DuplicateCase bool
	AssignCase    bool
}

CasePermissions are the permissions affecting the cases in a project

type DisplayPermissions added in v1.1.0

type DisplayPermissions struct {
	DisplayProject bool
}

DisplayPermissions are the permissions to display elements in the project

type ExecutionPermissions added in v1.0.0

type ExecutionPermissions struct {
	Execute bool
}

ExecutionPermissions are the permissions affecting the execution

type GitlabProject

type GitlabProject struct {
	IsActive bool
	ID       string // ID or url-encoded path of the project
	Token    string // Token to access the project
}

GitlabProject is the project in gitlab

type Integrations

type Integrations struct {
	GitlabProject GitlabProject
}

type Label added in v0.9.0

type Label struct {
	Id int64

	// Foreign Key ----------|
	ProjectId int64

	Name        string
	Description string
	Color       string
	TextColor   string
}

A Label is used to group tests

type MemberPermissions added in v1.0.0

type MemberPermissions struct {
	EditMembers bool
}

MemberPermissions are the permissions affecting the members in a project

type Permissions added in v1.0.0

Permissions are all permissions that a user can have in a project

type Project

type Project struct {
	Id      int64
	OwnerId int64

	Name        string
	Description string
	Image       string
	Token       string

	Visibility   visibility.Visibility
	CreationDate time.Time

	Owner       id.ActorID                    `xorm:"-"`
	Labels      []*Label                      `xorm:"-"`
	Versions    map[string]*Version           `xorm:"-"`
	UserMembers map[id.ActorID]UserMembership `xorm:"-"`
	Roles       map[RoleName]*Role            `xorm:"-"`

	Integrations Integrations `xorm:"-"`
}

The Project struct contains information used to describe a project in the system Image is a base64 encoded string

func NewProject

func NewProject(name string, owner id.ActorID, description string, visibility visibility.Visibility) Project

NewProject creates a new project

func (Project) AddMember added in v1.0.0

func (p Project) AddMember(member id.ActorID, role RoleName)

AddMember adds the given user to the project It creates a UserMembership with the given role name.

func (Project) GetLabelByName added in v1.1.0

func (p Project) GetLabelByName(labelName string) (Label, error)

GetLabelByName gets a label of a project by name

func (*Project) GetPermissions added in v1.0.0

func (p *Project) GetPermissions(u *user.User) Permissions

GetPermissions returns the permissions of a user in a project.

Every user can view public projects. Users that are a member of a public project have the permissions that are defined for his role.

Signed-In users can view internal projects. Users that are a member of an internal projects have the permissions that are defined for his role.

Users that are owner or members of a project can view a private project. Nobody else has access to these projects.

func (*Project) GetRole added in v1.7.0

func (p *Project) GetRole(u *user.User) *Role

GetRole returns the role of a user in a project. Returns nil if the user is nil or if the user does not exist in the project.

func (Project) ID

func (p Project) ID() id.ProjectID

ID returns a projects id

func (*Project) IsOwner added in v1.0.0

func (p *Project) IsOwner(u *user.User) bool

IsOwner checks whether the user is owner of the project. Returns false if the project or the user is nil or if the user is not the owner.

func (*Project) RemoveMember added in v1.0.0

func (p *Project) RemoveMember(member *user.User)

RemoveMember removes the given user of the project

func (Project) UpdateMember added in v1.3.0

func (p Project) UpdateMember(member *user.User, role RoleName)

updates the role of a member

type Role added in v1.0.0

type Role struct {
	Name        RoleName
	Permissions Permissions
}

A Role defines the permissions a user has in a project. It has a name and permissions.

type RoleName added in v1.0.0

type RoleName string

A RoleName is the name of a role in a project

func (*RoleName) String added in v1.0.0

func (r *RoleName) String() string

String returns the RoleName as string

type SequencePermissions added in v1.0.0

type SequencePermissions struct {
	CreateSequence    bool
	EditSequence      bool
	DeleteSequence    bool
	DuplicateSequence bool
	AssignSequence    bool
}

SequencePermissions are the permissions affecting the sequences in a project

type SettingsPermissions added in v1.0.0

type SettingsPermissions struct {
	EditProject     bool // Change name, description, image, visibility
	DeleteProject   bool
	EditPermissions bool
}

SettingsPermissions are the permissions affecting the settings of a project

type TestLabel

type TestLabel struct {
	Id int64

	// Foreign Key ----------|
	LabelId   int64
	TestId    int64
	ProjectId int64

	IsCase bool `xorm:"not null default 0"`
}

type UserMembership added in v1.0.0

type UserMembership struct {
	User        id.ActorID
	Role        RoleName
	MemberSince time.Time
}

UserMembership contains information about the membership of a user in a project

func NewUserMembership added in v1.0.0

func NewUserMembership(u id.ActorID, role RoleName) UserMembership

NewUserMembership creates a new membership with the user and the role. Returns a UserMembership.

func (UserMembership) UpdateRole added in v1.3.0

func (uM UserMembership) UpdateRole(role RoleName) UserMembership

type Variant added in v0.8.0

type Variant struct {
	Name string
}

The Variant struct contains the name of a system under test variant

type Version added in v0.8.0

type Version struct {
	Name     string
	Variants []Variant
}

The Version struct represents a system under test version and the variants applicable to it

Jump to

Keyboard shortcuts

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