Help us shape the future of Go! Take the 2026 Go Developer Survey

organization

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const MaxRepoTeamRules = 32
View Source
const OwnerTeamName = "Owners"

OwnerTeamName return the owner team name

Variables

View Source
var (
	ErrRepoTeamRuleInvalid  = errors.New("invalid repository team rule")
	ErrRepoTeamRuleConflict = errors.New("repository team rules changed")
)
View Source
var ErrInvalidOrgTask = errors.New("invalid organization task")

Functions

func AddOrgUser

func AddOrgUser(ctx context.Context, orgID, uid int64) error

AddOrgUser adds new user to given organization.

func AddTeamRepo

func AddTeamRepo(ctx context.Context, orgID, teamID, repoID int64) error

AddTeamRepo adds a repo for an organization's team

func ApplyTeamListFilter added in v1.3.0

func ApplyTeamListFilter(ctx context.Context, orgID int64, viewer *user_model.User, isSignedIn bool, opts *SearchTeamOptions) error

func CanCreateOrgRepo

func CanCreateOrgRepo(ctx context.Context, orgID, uid int64) (bool, error)

CanCreateOrgRepo returns true if user can create repo in organization

func ChangeOrgUserStatus

func ChangeOrgUserStatus(ctx context.Context, orgID, uid int64, public bool) error

ChangeOrgUserStatus changes public or private membership status.

func CountOrgMembers

func CountOrgMembers(ctx context.Context, opts *FindOrgMembersOpts) (int64, error)

CountOrgMembers counts the organization's members

func CreateOrgTask added in v1.3.0

func CreateOrgTask(ctx context.Context, task *OrgTask) error

func CreateOrganization

func CreateOrganization(ctx context.Context, org *Organization, owner *user_model.User) (err error)

CreateOrganization creates record of a new organization.

func DeleteOrgTask added in v1.3.0

func DeleteOrgTask(ctx context.Context, orgID, taskID int64) error

func DoerViewOtherVisibility

func DoerViewOtherVisibility(doer, other *user_model.User) structs.VisibleType

func FindOrgMembers

func FindOrgMembers(ctx context.Context, opts *FindOrgMembersOpts) (user_model.UserList, map[int64]bool, error)

FindOrgMembers loads organization members according conditions

func GetOrganizationCount

func GetOrganizationCount(ctx context.Context, u *user_model.User) (int64, error)

GetOrganizationCount returns count of membership of organization of the user.

func GetTeamIDsByNames

func GetTeamIDsByNames(ctx context.Context, orgID int64, names []string, ignoreNonExistent bool) ([]int64, error)

GetTeamIDsByNames returns a slice of team ids corresponds to names.

func GetTeamMembers

func GetTeamMembers(ctx context.Context, opts *SearchMembersOptions) ([]*user_model.User, error)

GetTeamMembers returns all members in given team of organization.

func GetTeamUserIDsWithAccessToAnyRepoUnit

func GetTeamUserIDsWithAccessToAnyRepoUnit(ctx context.Context, orgID, repoID int64, mode perm.AccessMode, unitType unit.Type, unitTypesMore ...unit.Type) (userIDs []int64, err error)

func GetTeamsByIDs

func GetTeamsByIDs(ctx context.Context, teamIDs []int64) (map[int64]*Team, error)

func GetUsersWhoCanCreateOrgRepo

func GetUsersWhoCanCreateOrgRepo(ctx context.Context, orgID int64) (map[int64]*user_model.User, error)

GetUsersWhoCanCreateOrgRepo returns users which are able to create repo in organization

func HasOrgOrUserVisible

func HasOrgOrUserVisible(ctx context.Context, orgOrUser, user *user_model.User) bool

HasOrgOrUserVisible tells if the given user can see the given org or user

func HasOrgsVisible

func HasOrgsVisible(ctx context.Context, orgs []*Organization, user *user_model.User) bool

HasOrgsVisible tells if the given user can see at least one of the orgs provided

func HasTeamRepo

func HasTeamRepo(ctx context.Context, orgID, teamID, repoID int64) bool

HasTeamRepo returns true if given repository belongs to team.

func IncrTeamRepoNum

func IncrTeamRepoNum(ctx context.Context, teamID int64) error

IncrTeamRepoNum increases the number of repos for the given team by 1

func IsErrLastOrgOwner

func IsErrLastOrgOwner(err error) bool

IsErrLastOrgOwner checks if an error is a ErrLastOrgOwner.

func IsErrOrgNotExist

func IsErrOrgNotExist(err error) bool

IsErrOrgNotExist checks if an error is a ErrOrgNotExist.

func IsErrTeamAlreadyExist

func IsErrTeamAlreadyExist(err error) bool

IsErrTeamAlreadyExist checks if an error is a ErrTeamAlreadyExist.

func IsErrTeamInviteAlreadyExist

func IsErrTeamInviteAlreadyExist(err error) bool

func IsErrTeamInviteNotFound

func IsErrTeamInviteNotFound(err error) bool

func IsErrTeamNotExist

func IsErrTeamNotExist(err error) bool

IsErrTeamNotExist checks if an error is a ErrTeamNotExist.

func IsErrUserEmailAlreadyAdded

func IsErrUserEmailAlreadyAdded(err error) bool

IsErrUserEmailAlreadyAdded checks if an error is a ErrUserEmailAlreadyAdded.

func IsErrUserHasOrgs

func IsErrUserHasOrgs(err error) bool

IsErrUserHasOrgs checks if an error is a ErrUserHasOrgs.

func IsErrUserNotAllowedCreateOrg

func IsErrUserNotAllowedCreateOrg(err error) bool

IsErrUserNotAllowedCreateOrg checks if an error is an ErrUserNotAllowedCreateOrg.

func IsOrganizationAdmin

func IsOrganizationAdmin(ctx context.Context, orgID, uid int64) (bool, error)

IsOrganizationAdmin returns true if given user is in the owner team or an admin team.

func IsOrganizationMember

func IsOrganizationMember(ctx context.Context, orgID, uid int64) (bool, error)

IsOrganizationMember returns true if given user is member of organization.

func IsOrganizationOwner

func IsOrganizationOwner(ctx context.Context, orgID, uid int64) (bool, error)

IsOrganizationOwner returns true if given user is in the owner team.

func IsPublicMembership

func IsPublicMembership(ctx context.Context, orgID, uid int64) (bool, error)

IsPublicMembership returns true if the given user's membership of given org is public.

func IsTeamMember

func IsTeamMember(ctx context.Context, orgID, teamID, userID int64) (bool, error)

IsTeamMember returns true if given user is a member of team.

func IsUsableTeamName

func IsUsableTeamName(name string) error

IsUsableTeamName tests if a name could be as team name

func IsUserInTeams

func IsUserInTeams(ctx context.Context, userID int64, teamIDs []int64) (bool, error)

IsUserInTeams returns if a user in some teams

func IsUserOrgOwner

func IsUserOrgOwner(ctx context.Context, users user_model.UserList, orgID int64) map[int64]bool

IsUserOrgOwner returns true if user is in the owner team of given organization.

func MoveOrgTask added in v1.3.0

func MoveOrgTask(ctx context.Context, orgID, taskID int64, status string) (bool, error)

func NormalizeTeamVisibility added in v1.3.0

func NormalizeTeamVisibility(s string) structs.VisibleType

func RemoveInviteByID

func RemoveInviteByID(ctx context.Context, inviteID, teamID int64) error

func RemoveOrgRepo

func RemoveOrgRepo(ctx context.Context, orgID, repoID int64) error

RemoveOrgRepo removes all team-repository relations of organization.

func RemoveTeamFromRepoRules added in v1.4.0

func RemoveTeamFromRepoRules(ctx context.Context, orgID, teamID int64) error

RemoveTeamFromRepoRules prevents a deleted team from leaving uneditable rules.

func RemoveTeamRepo

func RemoveTeamRepo(ctx context.Context, teamID, repoID int64) error

RemoveTeamRepo remove repository from team

func RepoTeamRulesKey added in v1.4.0

func RepoTeamRulesKey(orgID int64) string

func SaveRepoTeamRules added in v1.4.0

func SaveRepoTeamRules(ctx context.Context, orgID, revision int64, rules []RepoTeamRule) error

func UpdateOrgTask added in v1.3.0

func UpdateOrgTask(ctx context.Context, task *OrgTask) (bool, error)

func UsersInTeamsCount

func UsersInTeamsCount(ctx context.Context, userIDs, teamIDs []int64) (int64, error)

UsersInTeamsCount counts the number of users which are in userIDs and teamIDs

func ValidOrgTaskStatus added in v1.3.0

func ValidOrgTaskStatus(status string) bool

func ValidateOrgTask added in v1.3.0

func ValidateOrgTask(ctx context.Context, task *OrgTask) error

func ValidateRepoTeamRules added in v1.4.0

func ValidateRepoTeamRules(rules []RepoTeamRule, teams []*Team) error

ValidateRepoTeamRules disallows implicit owner access and cross-organization teams.

func VisibleTeamVisibilitiesFor added in v1.3.0

func VisibleTeamVisibilitiesFor(isOrgMember, isSignedIn bool) []structs.VisibleType

Types

type ErrLastOrgOwner

type ErrLastOrgOwner struct {
	UID int64
}

ErrLastOrgOwner represents a "LastOrgOwner" kind of error.

func (ErrLastOrgOwner) Error

func (err ErrLastOrgOwner) Error() string

type ErrOrgNotExist

type ErrOrgNotExist struct {
	ID   int64
	Name string
}

ErrOrgNotExist represents a "OrgNotExist" kind of error.

func (ErrOrgNotExist) Error

func (err ErrOrgNotExist) Error() string

func (ErrOrgNotExist) Unwrap

func (err ErrOrgNotExist) Unwrap() error

type ErrTeamAlreadyExist

type ErrTeamAlreadyExist struct {
	OrgID int64
	Name  string
}

ErrTeamAlreadyExist represents a "TeamAlreadyExist" kind of error.

func (ErrTeamAlreadyExist) Error

func (err ErrTeamAlreadyExist) Error() string

func (ErrTeamAlreadyExist) Unwrap

func (err ErrTeamAlreadyExist) Unwrap() error

type ErrTeamInviteAlreadyExist

type ErrTeamInviteAlreadyExist struct {
	TeamID int64
	Email  string
}

func (ErrTeamInviteAlreadyExist) Error

func (err ErrTeamInviteAlreadyExist) Error() string

func (ErrTeamInviteAlreadyExist) Unwrap

func (err ErrTeamInviteAlreadyExist) Unwrap() error

type ErrTeamInviteNotFound

type ErrTeamInviteNotFound struct {
	Token string
}

func (ErrTeamInviteNotFound) Error

func (err ErrTeamInviteNotFound) Error() string

func (ErrTeamInviteNotFound) Unwrap

func (err ErrTeamInviteNotFound) Unwrap() error

type ErrTeamNotExist

type ErrTeamNotExist struct {
	OrgID  int64
	TeamID int64
	Name   string
}

ErrTeamNotExist represents a "TeamNotExist" error

func (ErrTeamNotExist) Error

func (err ErrTeamNotExist) Error() string

func (ErrTeamNotExist) Unwrap

func (err ErrTeamNotExist) Unwrap() error

type ErrUserEmailAlreadyAdded

type ErrUserEmailAlreadyAdded struct {
	Email string
}

ErrUserEmailAlreadyAdded represents a "user by email already added to team" error.

func (ErrUserEmailAlreadyAdded) Error

func (err ErrUserEmailAlreadyAdded) Error() string

func (ErrUserEmailAlreadyAdded) Unwrap

func (err ErrUserEmailAlreadyAdded) Unwrap() error

type ErrUserHasOrgs

type ErrUserHasOrgs struct {
	UID int64
}

ErrUserHasOrgs represents a "UserHasOrgs" kind of error.

func (ErrUserHasOrgs) Error

func (err ErrUserHasOrgs) Error() string

type ErrUserNotAllowedCreateOrg

type ErrUserNotAllowedCreateOrg struct{}

ErrUserNotAllowedCreateOrg represents a "UserNotAllowedCreateOrg" kind of error.

func (ErrUserNotAllowedCreateOrg) Error

func (err ErrUserNotAllowedCreateOrg) Error() string

func (ErrUserNotAllowedCreateOrg) Unwrap

func (err ErrUserNotAllowedCreateOrg) Unwrap() error

type FindOrgMembersOpts

type FindOrgMembersOpts struct {
	db.ListOptions
	Doer         *user_model.User
	IsDoerMember bool
	OrgID        int64
	Keyword      string
}

FindOrgMembersOpts represents find org members conditions

func (FindOrgMembersOpts) PublicOnly

func (opts FindOrgMembersOpts) PublicOnly() bool

type FindOrgOptions

type FindOrgOptions struct {
	db.ListOptions
	UserID            int64
	IncludeVisibility structs.VisibleType
}

FindOrgOptions finds orgs options

func (*FindOrgOptions) ApplyPublicOnly

func (opts *FindOrgOptions) ApplyPublicOnly(publicOnly bool)

func (FindOrgOptions) ToConds

func (opts FindOrgOptions) ToConds() builder.Cond

func (FindOrgOptions) ToOrders

func (opts FindOrgOptions) ToOrders() string

type MinimalOrg

type MinimalOrg = Organization

MinimalOrg represents a simple organization with only the needed columns

func GetUserOrgsList

func GetUserOrgsList(ctx context.Context, user *user_model.User) ([]*MinimalOrg, error)

GetUserOrgsList returns all organizations the given user has access to

type OrgList

type OrgList []*Organization

func (OrgList) LoadTeams

func (orgs OrgList) LoadTeams(ctx context.Context) (map[int64]TeamList, error)

type OrgTask added in v1.3.0

type OrgTask struct {
	ID          int64  `xorm:"pk autoincr"`
	OrgID       int64  `xorm:"INDEX NOT NULL"`
	Title       string `xorm:"VARCHAR(255) NOT NULL"`
	Content     string `xorm:"TEXT"`
	Status      string `xorm:"VARCHAR(16) NOT NULL"`
	AssigneeID  int64  `xorm:"INDEX"`
	CreatorID   int64
	CreatedUnix timeutil.TimeStamp `xorm:"created"`
	UpdatedUnix timeutil.TimeStamp `xorm:"updated"`
}

OrgTask is a standalone card on an organization's single shared board.

func FindOrgTasks added in v1.3.0

func FindOrgTasks(ctx context.Context, orgID int64, query string, assigneeID int64) ([]*OrgTask, int64, error)

FindOrgTasks bounds rendering cost; the total lets the UI request a narrower search.

func GetOrgTask added in v1.3.0

func GetOrgTask(ctx context.Context, orgID, taskID int64) (*OrgTask, bool, error)

type OrgUser

type OrgUser struct {
	ID       int64 `xorm:"pk autoincr"`
	UID      int64 `xorm:"INDEX UNIQUE(s)"`
	OrgID    int64 `xorm:"INDEX UNIQUE(s)"`
	IsPublic bool  `xorm:"INDEX"`
}

OrgUser represents an organization-user relation.

func GetOrgUsersByOrgID

func GetOrgUsersByOrgID(ctx context.Context, opts *FindOrgMembersOpts) ([]*OrgUser, error)

GetOrgUsersByOrgID returns all organization-user relations by organization ID.

type Organization

type Organization user_model.User

Organization represents an organization

func GetOrgByID

func GetOrgByID(ctx context.Context, id int64) (*Organization, error)

GetOrgByID returns the user object by given ID if exists.

func GetOrgByName

func GetOrgByName(ctx context.Context, name string) (*Organization, error)

GetOrgByName returns organization by given name.

func GetOrgsCanCreateRepoByUserID

func GetOrgsCanCreateRepoByUserID(ctx context.Context, userID int64) ([]*Organization, error)

GetOrgsCanCreateRepoByUserID returns a list of organizations where given user ID are allowed to create repos.

func OrgFromUser

func OrgFromUser(user *user_model.User) *Organization

OrgFromUser converts user to organization

func (*Organization) AsUser

func (org *Organization) AsUser() *user_model.User

AsUser returns the org as user object

func (org *Organization) AvatarLink(ctx context.Context) string

AvatarLink returns the full avatar link with http host

func (*Organization) CanCreateOrgRepo

func (org *Organization) CanCreateOrgRepo(ctx context.Context, uid int64) (bool, error)

CanCreateOrgRepo returns true if given user can create repo in organization

func (*Organization) CustomAvatarRelativePath

func (org *Organization) CustomAvatarRelativePath() string

CustomAvatarRelativePath returns user custom avatar relative path.

func (*Organization) DisplayName

func (org *Organization) DisplayName() string

DisplayName returns full name if it's not empty, returns username otherwise.

func (*Organization) GetMembers

func (org *Organization) GetMembers(ctx context.Context, doer *user_model.User) (user_model.UserList, map[int64]bool, error)

GetMembers returns all members of organization.

func (*Organization) GetOrgUserMaxAuthorizeLevel

func (org *Organization) GetOrgUserMaxAuthorizeLevel(ctx context.Context, uid int64) (perm.AccessMode, error)

GetOrgUserMaxAuthorizeLevel returns highest authorize level of user in an organization

func (*Organization) GetOwnerTeam

func (org *Organization) GetOwnerTeam(ctx context.Context) (*Team, error)

GetOwnerTeam returns owner team of organization.

func (*Organization) GetTeam

func (org *Organization) GetTeam(ctx context.Context, name string) (*Team, error)

GetTeam returns named team of organization.

func (*Organization) GetUserTeamIDs

func (org *Organization) GetUserTeamIDs(ctx context.Context, userID int64) ([]int64, error)

GetUserTeamIDs returns of all team IDs of the organization that user is member of.

func (*Organization) GetUserTeams

func (org *Organization) GetUserTeams(ctx context.Context, userID int64, cols ...string) ([]*Team, error)

GetUserTeams returns all teams that belong to user, and that the user has joined.

func (*Organization) HTMLURL

func (org *Organization) HTMLURL(ctx context.Context) string

HTMLURL returns the organization's full link.

func (*Organization) HasMemberWithUserID

func (org *Organization) HasMemberWithUserID(ctx context.Context, userID int64) bool

HasMemberWithUserID returns true if user with userID is part of the u organisation.

func (org *Organization) HomeLink() string

HomeLink returns the user or organization home page link.

func (*Organization) IsOrgAdmin

func (org *Organization) IsOrgAdmin(ctx context.Context, uid int64) (bool, error)

IsOrgAdmin returns true if given user is in the owner team or an admin team.

func (*Organization) IsOrgMember

func (org *Organization) IsOrgMember(ctx context.Context, uid int64) (bool, error)

IsOrgMember returns true if given user is member of organization.

func (*Organization) IsOwnedBy

func (org *Organization) IsOwnedBy(ctx context.Context, uid int64) (bool, error)

IsOwnedBy returns true if given user is in the owner team.

func (*Organization) LoadTeams

func (org *Organization) LoadTeams(ctx context.Context) ([]*Team, error)

LoadTeams load teams if not loaded.

func (org *Organization) OrganisationLink() string

OrganisationLink returns the organization sub page link.

func (*Organization) ShortName

func (org *Organization) ShortName(length int) string

ShortName ellipses username to length

func (Organization) TableName

func (Organization) TableName() string

TableName represents the real table name of Organization

func (*Organization) UnitPermission

func (org *Organization) UnitPermission(ctx context.Context, doer *user_model.User, unitType unit.Type) perm.AccessMode

UnitPermission returns unit permission

type RepoTeamRule added in v1.4.0

type RepoTeamRule struct {
	ID      string  `json:"id"`
	Pattern string  `json:"pattern"`
	TeamIDs []int64 `json:"team_ids"`
	Enabled bool    `json:"enabled"`
}

RepoTeamRule matches the repository name, independently of mutable team labels.

type RepoTeamRules added in v1.4.0

type RepoTeamRules struct {
	Rules    []RepoTeamRule `json:"rules"`
	Revision int64          `json:"-"`
}

func LoadRepoTeamRules added in v1.4.0

func LoadRepoTeamRules(ctx context.Context, orgID int64) (*RepoTeamRules, error)

func (*RepoTeamRules) Match added in v1.4.0

func (s *RepoTeamRules) Match(name string) ([]int64, error)

Match unions enabled rules; Go's RE2 syntax has bounded matching time.

type SearchMembersOptions

type SearchMembersOptions struct {
	db.ListOptions
	TeamID int64
}

SearchMembersOptions holds the search options

type SearchOrganizationsOptions

type SearchOrganizationsOptions struct {
	db.ListOptions
	All bool
}

SearchOrganizationsOptions options to filter organizations

type SearchTeamOptions

type SearchTeamOptions struct {
	db.ListOptions
	UserID      int64
	Keyword     string
	OrgID       int64
	IncludeDesc bool
	// IncludeVisibilities, when combined with UserID, also returns teams whose
	// visibility is in this list, even if UserID is not a member. Typical values:
	//   - {limited,public} for org members
	//   - {public} for signed-in users who are not org members
	// Leave empty to return only teams the user is a member of.
	IncludeVisibilities []structs.VisibleType
}

SearchTeamOptions holds the search options

type Team

type Team struct {
	ID                      int64 `xorm:"pk autoincr"`
	OrgID                   int64 `xorm:"INDEX"`
	LowerName               string
	Name                    string
	DisplayName             string
	Description             string
	AccessMode              perm.AccessMode    `xorm:"'authorize'"`
	Members                 []*user_model.User `xorm:"-"`
	NumRepos                int
	NumMembers              int
	Units                   []*TeamUnit         `xorm:"-"`
	IncludesAllRepositories bool                `xorm:"NOT NULL DEFAULT false"`
	CanCreateOrgRepo        bool                `xorm:"NOT NULL DEFAULT false"`
	Visibility              structs.VisibleType `xorm:"NOT NULL DEFAULT 2"`
}

Team represents a organization team.

func FindOrgTeams

func FindOrgTeams(ctx context.Context, orgID int64) ([]*Team, error)

FindOrgTeams returns all teams of a given organization

func GetOwnerTeam

func GetOwnerTeam(ctx context.Context, orgID int64) (*Team, error)

GetOwnerTeam returns team by given team name and organization.

func GetPossibleTeamByID added in v1.3.0

func GetPossibleTeamByID(ctx context.Context, teamID int64) (int64, *Team, error)

func GetTeam

func GetTeam(ctx context.Context, orgID int64, name string) (*Team, error)

GetTeam returns team by given team name and organization.

func GetTeamByID

func GetTeamByID(ctx context.Context, teamID int64) (*Team, error)

GetTeamByID returns team by given ID.

func GetTeamsWithAccessToAnyRepoUnit

func GetTeamsWithAccessToAnyRepoUnit(ctx context.Context, orgID, repoID int64, mode perm.AccessMode, unitType unit.Type, unitTypesMore ...unit.Type) (teams []*Team, err error)

GetTeamsWithAccessToAnyRepoUnit returns all teams in an organization that have given access level to the repository special unit. This function is only used for finding some teams that can be used as branch protection allowlist or reviewers, it isn't really used for access control. FIXME: TEAM-UNIT-PERMISSION this logic is not complete, search the fixme keyword to see more details

func (*Team) CanNonMemberReadMeta added in v1.3.0

func (t *Team) CanNonMemberReadMeta(ctx context.Context, org, doer *user_model.User) (bool, error)

CanNonMemberReadMeta reports whether a non-member, non-owner doer may read the team's metadata, based on the team's visibility tier and the parent org's visibility. Privileged callers (site admins, org owners, team members) are decided by the caller before reaching here.

func (*Team) DisplayLabel added in v1.3.0

func (t *Team) DisplayLabel() string

DisplayLabel keeps editable labels separate from the team's compatibility name.

func (*Team) GetUnitNames

func (t *Team) GetUnitNames() (res []string)

GetUnitNames returns the team units names

func (*Team) GetUnitsMap

func (t *Team) GetUnitsMap() map[string]string

GetUnitsMap returns the team units permissions

func (*Team) HasAdminAccess

func (t *Team) HasAdminAccess() bool

func (*Team) IsLimited added in v1.3.0

func (t *Team) IsLimited() bool

func (*Team) IsMember

func (t *Team) IsMember(ctx context.Context, userID int64) bool

IsMember returns true if given user is a member of team.

func (*Team) IsOwnerTeam

func (t *Team) IsOwnerTeam() bool

IsOwnerTeam returns true if team is owner team.

func (*Team) IsPrivate added in v1.3.0

func (t *Team) IsPrivate() bool

func (*Team) IsPublic added in v1.3.0

func (t *Team) IsPublic() bool

func (*Team) LoadMembers

func (t *Team) LoadMembers(ctx context.Context) (err error)

LoadMembers returns paginated members in team of organization.

func (*Team) LoadUnits

func (t *Team) LoadUnits(ctx context.Context) (err error)

LoadUnits load a list of available units for a team

func (*Team) LogString

func (t *Team) LogString() string

func (*Team) UnitAccessMode

func (t *Team) UnitAccessMode(ctx context.Context, tp unit.Type) perm.AccessMode

UnitAccessMode returns the access mode for the given unit type, "none" for non-existent units

func (*Team) UnitAccessModeEx

func (t *Team) UnitAccessModeEx(ctx context.Context, tp unit.Type) (accessMode perm.AccessMode, exist bool)

func (*Team) UnitEnabled

func (t *Team) UnitEnabled(ctx context.Context, tp unit.Type) bool

UnitEnabled returns true if the team has the given unit type enabled

type TeamInvite

type TeamInvite struct {
	ID          int64              `xorm:"pk autoincr"`
	Token       string             `xorm:"UNIQUE(token) INDEX NOT NULL DEFAULT ''"`
	InviterID   int64              `xorm:"NOT NULL DEFAULT 0"`
	OrgID       int64              `xorm:"INDEX NOT NULL DEFAULT 0"`
	TeamID      int64              `xorm:"UNIQUE(team_mail) INDEX NOT NULL DEFAULT 0"`
	Email       string             `xorm:"UNIQUE(team_mail) NOT NULL DEFAULT ''"`
	CreatedUnix timeutil.TimeStamp `xorm:"INDEX created"`
	UpdatedUnix timeutil.TimeStamp `xorm:"INDEX updated"`
}

TeamInvite represents an invite to a team

func CreateTeamInvite

func CreateTeamInvite(ctx context.Context, doer *user_model.User, team *Team, email string) (*TeamInvite, error)

func GetInviteByToken

func GetInviteByToken(ctx context.Context, token string) (*TeamInvite, error)

func GetInvitesByTeamID

func GetInvitesByTeamID(ctx context.Context, teamID int64) ([]*TeamInvite, error)

type TeamList

type TeamList []*Team

func GetRepoTeams

func GetRepoTeams(ctx context.Context, orgID, repoID int64) (teams TeamList, err error)

GetRepoTeams gets the list of teams that has access to the repository

func GetTeamsByOrgIDs

func GetTeamsByOrgIDs(ctx context.Context, orgIDs []int64) (TeamList, error)

func GetUserOrgTeams

func GetUserOrgTeams(ctx context.Context, orgID, userID int64) (teams TeamList, err error)

GetUserOrgTeams returns all teams that user belongs to in given organization.

func GetUserRepoTeams

func GetUserRepoTeams(ctx context.Context, orgID, userID, repoID int64) (teams TeamList, err error)

GetUserRepoTeams returns user repo's teams

func SearchTeam

func SearchTeam(ctx context.Context, opts *SearchTeamOptions) (TeamList, int64, error)

SearchTeam search for teams. Caller is responsible to check permissions.

func (TeamList) LoadUnits

func (t TeamList) LoadUnits(ctx context.Context) error

func (TeamList) UnitMaxAccess

func (t TeamList) UnitMaxAccess(tp unit.Type) perm.AccessMode

type TeamRepo

type TeamRepo struct {
	ID     int64 `xorm:"pk autoincr"`
	OrgID  int64 `xorm:"INDEX"`
	TeamID int64 `xorm:"UNIQUE(s)"`
	RepoID int64 `xorm:"UNIQUE(s)"`
}

TeamRepo represents an team-repository relation.

type TeamUnit

type TeamUnit struct {
	ID         int64     `xorm:"pk autoincr"`
	OrgID      int64     `xorm:"INDEX"`
	TeamID     int64     `xorm:"UNIQUE(s)"`
	Type       unit.Type `xorm:"UNIQUE(s)"`
	AccessMode perm.AccessMode
}

TeamUnit describes all units of a repository

func (*TeamUnit) Unit

func (t *TeamUnit) Unit() unit.Unit

Unit returns Unit

type TeamUser

type TeamUser struct {
	ID     int64 `xorm:"pk autoincr"`
	OrgID  int64 `xorm:"INDEX"`
	TeamID int64 `xorm:"UNIQUE(s)"`
	UID    int64 `xorm:"UNIQUE(s)"`
}

TeamUser represents an team-user relation.

type WorktimeSumByMembers

type WorktimeSumByMembers struct {
	UserName string
	SumTime  int64
}

func GetWorktimeByMembers

func GetWorktimeByMembers(ctx context.Context, org *Organization, unitFrom, unixTo int64) (results []WorktimeSumByMembers, err error)

type WorktimeSumByMilestones

type WorktimeSumByMilestones struct {
	RepoName          string
	MilestoneName     string
	MilestoneID       int64
	MilestoneDeadline int64
	SumTime           int64
	HideRepoName      bool
}

func GetWorktimeByMilestones

func GetWorktimeByMilestones(ctx context.Context, org *Organization, unitFrom, unixTo int64) (results []WorktimeSumByMilestones, err error)

type WorktimeSumByRepos

type WorktimeSumByRepos struct {
	RepoName string
	SumTime  int64
}

func GetWorktimeByRepos

func GetWorktimeByRepos(ctx context.Context, org *Organization, unitFrom, unixTo int64) (results []WorktimeSumByRepos, err error)

Jump to

Keyboard shortcuts

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