org

package
v0.0.1-test Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2022 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrOrgNotFound  = errors.New("organization not found")
	ErrOrgNameTaken = errors.New("organization name is taken")
)

Typed errors

Functions

This section is empty.

Types

type AddOrgUserCommand

type AddOrgUserCommand struct {
	LoginOrEmail string   `json:"loginOrEmail" binding:"Required"`
	Role         RoleType `json:"role" binding:"Required"`

	OrgID  int64 `json:"-" xorm:"org_id"`
	UserID int64 `json:"-" xorm:"user_id"`

	// internal use: avoid adding service accounts to orgs via user routes
	AllowAddingServiceAccount bool `json:"-"`
}

type Address

type Address struct {
	Address1 string `json:"address1"`
	Address2 string `json:"address2"`
	City     string `json:"city"`
	ZipCode  string `json:"zipCode"`
	State    string `json:"state"`
	Country  string `json:"country"`
}

type ByOrgName

type ByOrgName []*UserOrgDTO

func (ByOrgName) Len

func (o ByOrgName) Len() int

Len returns the length of an array of organisations.

func (ByOrgName) Less

func (o ByOrgName) Less(i, j int) bool

Less returns whether element i of an array of organizations is less than element j.

func (ByOrgName) Swap

func (o ByOrgName) Swap(i, j int)

Swap swaps two indices of an array of organizations.

type CreateOrgCommand

type CreateOrgCommand struct {
	Name string `json:"name" binding:"Required"`

	// initial admin user for account
	UserID int64 `json:"-" xorm:"user_id"`
}

type DeleteOrgCommand

type DeleteOrgCommand struct {
	ID int64 `xorm:"id"`
}

type GetOrgByIdQuery

type GetOrgByIdQuery struct {
	ID int64
}

type GetOrgByNameQuery

type GetOrgByNameQuery struct {
	Name string
}

type GetOrgIDForNewUserCommand

type GetOrgIDForNewUserCommand struct {
	Email        string
	Login        string
	OrgID        int64
	OrgName      string
	SkipOrgSetup bool
}

type GetOrgUsersQuery

type GetOrgUsersQuery struct {
	UserID int64 `xorm:"user_id"`
	OrgID  int64 `xorm:"org_id"`
	Query  string
	Limit  int
	// Flag used to allow oss edition to query users without access control
	DontEnforceAccessControl bool

	User *user.SignedInUser
}

type GetUserOrgListQuery

type GetUserOrgListQuery struct {
	UserID int64 `xorm:"user_id"`
}

type Org

type Org struct {
	ID      int64 `xorm:"pk autoincr 'id'"`
	Version int
	Name    string

	Address1 string
	Address2 string
	City     string
	ZipCode  string
	State    string
	Country  string

	Created time.Time
	Updated time.Time
}

type OrgDTO

type OrgDTO struct {
	ID   int64  `json:"id" xorm:"id"`
	Name string `json:"name"`
}

type OrgUser

type OrgUser struct {
	ID      int64 `xorm:"pk autoincr 'id'"`
	OrgID   int64 `xorm:"org_id"`
	UserID  int64 `xorm:"user_id"`
	Role    RoleType
	Created time.Time
	Updated time.Time
}

type OrgUserDTO

type OrgUserDTO struct {
	OrgID         int64           `json:"orgId" xorm:"org_id"`
	UserID        int64           `json:"userId" xorm:"user_id"`
	Email         string          `json:"email"`
	Name          string          `json:"name"`
	AvatarURL     string          `json:"avatarUrl" xorm:"avatar_url"`
	Login         string          `json:"login"`
	Role          string          `json:"role"`
	LastSeenAt    time.Time       `json:"lastSeenAt"`
	Updated       time.Time       `json:"-"`
	Created       time.Time       `json:"-"`
	LastSeenAtAge string          `json:"lastSeenAtAge"`
	AccessControl map[string]bool `json:"accessControl,omitempty"`
	IsDisabled    bool            `json:"isDisabled"`
}

type RemoveOrgUserCommand

type RemoveOrgUserCommand struct {
	UserID                   int64 `xorm:"user_id"`
	OrgID                    int64 `xorm:"org_id"`
	ShouldDeleteOrphanedUser bool
	UserWasDeleted           bool
}

type RoleType

type RoleType = roletype.RoleType
const (
	RoleViewer RoleType = "Viewer"
	RoleEditor RoleType = "Editor"
	RoleAdmin  RoleType = "Admin"
)

type SearchOrgUsersQuery

type SearchOrgUsersQuery struct {
	OrgID int64 `xorm:"org_id"`
	Query string
	Page  int
	Limit int

	User *user.SignedInUser
}

type SearchOrgUsersQueryResult

type SearchOrgUsersQueryResult struct {
	TotalCount int64         `json:"totalCount"`
	OrgUsers   []*OrgUserDTO `json:"OrgUsers"`
	Page       int           `json:"page"`
	PerPage    int           `json:"perPage"`
}

type SearchOrgsQuery

type SearchOrgsQuery struct {
	Query string
	Name  string
	Limit int
	Page  int
	IDs   []int64 `xorm:"ids"`
}

type UpdateOrgAddressCommand

type UpdateOrgAddressCommand struct {
	OrgID int64 `xorm:"org_id"`
	Address
}

type UpdateOrgCommand

type UpdateOrgCommand struct {
	Name  string
	OrgId int64
}

type UpdateOrgUserCommand

type UpdateOrgUserCommand struct {
	Role RoleType `json:"role" binding:"Required"`

	OrgID  int64 `json:"-"`
	UserID int64 `json:"-"`
}

type UserOrgDTO

type UserOrgDTO struct {
	OrgID int64    `json:"orgId" xorm:"org_id"`
	Name  string   `json:"name"`
	Role  RoleType `json:"role"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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