Documentation ¶
Index ¶
- Constants
- Variables
- type AddTeamMemberCommand
- type CreateTeamCommand
- type DeleteTeamCommand
- type GetTeamByIDQuery
- type GetTeamMembersQuery
- type GetTeamsByUserQuery
- type IsAdminOfTeamsQuery
- type RemoveTeamMemberCommand
- type SearchTeamQueryResult
- type SearchTeamsQuery
- type Service
- type Team
- type TeamDTO
- type TeamMember
- type TeamMemberDTO
- type UpdateTeamCommand
- type UpdateTeamMemberCommand
Constants ¶
View Source
const FilterIgnoreUser int64 = 0
FilterIgnoreUser is used in a get / search teams query when the caller does not want to filter teams by user ID / membership
Variables ¶
View Source
var ( ErrTeamNotFound = errors.New("team not found") ErrTeamNameTaken = errors.New("team name is taken") ErrTeamMemberNotFound = errors.New("team member not found") ErrLastTeamAdmin = errors.New("not allowed to remove last admin") ErrNotAllowedToUpdateTeam = errors.New("user not allowed to update team") ErrNotAllowedToUpdateTeamInDifferentOrg = errors.New("user not allowed to update team in another org") ErrTeamMemberAlreadyAdded = errors.New("user is already added to this team") )
Typed errors
Functions ¶
This section is empty.
Types ¶
type AddTeamMemberCommand ¶
type AddTeamMemberCommand struct { UserID int64 `json:"userId" binding:"Required"` OrgID int64 `json:"-"` TeamID int64 `json:"-"` External bool `json:"-"` Permission dashboards.PermissionType `json:"-"` }
type CreateTeamCommand ¶
type DeleteTeamCommand ¶
type GetTeamByIDQuery ¶
type GetTeamMembersQuery ¶
type GetTeamsByUserQuery ¶
type GetTeamsByUserQuery struct { OrgID int64 UserID int64 `json:"userId"` SignedInUser *user.SignedInUser }
type IsAdminOfTeamsQuery ¶
type IsAdminOfTeamsQuery struct {
SignedInUser *user.SignedInUser
}
type RemoveTeamMemberCommand ¶
type SearchTeamQueryResult ¶
type SearchTeamsQuery ¶
type Service ¶
type Service interface { CreateTeam(name, email string, orgID int64) (Team, error) UpdateTeam(ctx context.Context, cmd *UpdateTeamCommand) error DeleteTeam(ctx context.Context, cmd *DeleteTeamCommand) error SearchTeams(ctx context.Context, query *SearchTeamsQuery) (SearchTeamQueryResult, error) GetTeamByID(ctx context.Context, query *GetTeamByIDQuery) (*TeamDTO, error) GetTeamsByUser(ctx context.Context, query *GetTeamsByUserQuery) ([]*TeamDTO, error) AddTeamMember(userID, orgID, teamID int64, isExternal bool, permission dashboards.PermissionType) error UpdateTeamMember(ctx context.Context, cmd *UpdateTeamMemberCommand) error IsTeamMember(orgId int64, teamId int64, userId int64) (bool, error) RemoveTeamMember(ctx context.Context, cmd *RemoveTeamMemberCommand) error GetUserTeamMemberships(ctx context.Context, orgID, userID int64, external bool) ([]*TeamMemberDTO, error) GetTeamMembers(ctx context.Context, query *GetTeamMembersQuery) ([]*TeamMemberDTO, error) IsAdminOfTeams(ctx context.Context, query *IsAdminOfTeamsQuery) (bool, error) }
type Team ¶
type Team struct { ID int64 `json:"id" xorm:"pk autoincr 'id'"` OrgID int64 `json:"orgId" xorm:"org_id"` Name string `json:"name"` Email string `json:"email"` Created time.Time `json:"created"` Updated time.Time `json:"updated"` }
Team model
type TeamDTO ¶
type TeamDTO struct { ID int64 `json:"id" xorm:"id"` OrgID int64 `json:"orgId" xorm:"org_id"` Name string `json:"name"` Email string `json:"email"` AvatarURL string `json:"avatarUrl"` MemberCount int64 `json:"memberCount"` Permission dashboards.PermissionType `json:"permission"` AccessControl map[string]bool `json:"accessControl"` }
type TeamMember ¶
type TeamMember struct { ID int64 `xorm:"pk autoincr 'id'"` OrgID int64 `xorm:"org_id"` TeamID int64 `xorm:"team_id"` UserID int64 `xorm:"user_id"` External bool // Signals that the membership has been created by an external systems, such as LDAP Permission dashboards.PermissionType Created time.Time Updated time.Time }
TeamMember model
type TeamMemberDTO ¶
type TeamMemberDTO struct { OrgID int64 `json:"orgId" xorm:"org_id"` TeamID int64 `json:"teamId" xorm:"team_id"` UserID int64 `json:"userId" xorm:"user_id"` External bool `json:"-"` AuthModule string `json:"auth_module"` Email string `json:"email"` Name string `json:"name"` Login string `json:"login"` AvatarURL string `json:"avatarUrl" xorm:"avatar_url"` Labels []string `json:"labels"` Permission dashboards.PermissionType `json:"permission"` }
type UpdateTeamCommand ¶
type UpdateTeamMemberCommand ¶
type UpdateTeamMemberCommand struct { UserID int64 `json:"-"` OrgID int64 `json:"-"` TeamID int64 `json:"-"` Permission dashboards.PermissionType `json:"permission"` }
Click to show internal directories.
Click to hide internal directories.