Back to

package organization

Latest Go to latest
Published: Aug 29, 2019 | License: AGPL-3.0 | Module:


func GetRequestSubdomain

func GetRequestSubdomain(r *http.Request) string

GetRequestSubdomain extracts subdomain from referring URL.

func GetSubdomainFromHost

func GetSubdomainFromHost(r *http.Request) string

GetSubdomainFromHost extracts the subdomain from the requesting URL.

type Handler

type Handler struct {
	Runtime *env.Runtime
	Store   *store.Store

Handler contains the runtime information such as logging and database.

func (*Handler) Get

func (h *Handler) Get(w http.ResponseWriter, r *http.Request)

Get returns the requested organization.

func (*Handler) Update

func (h *Handler) Update(w http.ResponseWriter, r *http.Request)

Update saves organization amends.

func (h *Handler) UploadLogo(w http.ResponseWriter, r *http.Request)

UploadLogo stores log for organization.

type Store

type Store struct {

Store provides data access to organization (tenant) information.

func (Store) AddOrganization

func (s Store) AddOrganization(ctx domain.RequestContext, o org.Organization) (err error)

AddOrganization inserts the passed organization record into the organization table.

func (Store) CheckDomain

func (s Store) CheckDomain(ctx domain.RequestContext, domain string) string

CheckDomain makes sure there is an organisation with the correct domain

func (Store) DeleteOrganization

func (s Store) DeleteOrganization(ctx domain.RequestContext, orgID string) (rows int64, err error)

DeleteOrganization deletes the orgID organization from the organization table.

func (Store) GetOrganization

func (s Store) GetOrganization(ctx domain.RequestContext, id string) (org org.Organization, err error)

GetOrganization returns the Organization record from the organization database table with the given id.

func (Store) GetOrganizationByDomain

func (s Store) GetOrganizationByDomain(subdomain string) (o org.Organization, err error)

GetOrganizationByDomain returns the organization matching a given URL subdomain. No context is required because user might not be authenticated yet.

func (s Store) Logo(ctx domain.RequestContext, domain string) (l []byte, err error)

Logo fetchs stored image from store or NULL.

func (Store) RemoveOrganization

func (s Store) RemoveOrganization(ctx domain.RequestContext, orgID string) (err error)

RemoveOrganization sets the orgID organization to be inactive, thus executing a "soft delete" operation.

func (Store) UpdateAuthConfig

func (s Store) UpdateAuthConfig(ctx domain.RequestContext, org org.Organization) (err error)

UpdateAuthConfig updates the given organization record in the database with the auth config details.

func (Store) UpdateOrganization

func (s Store) UpdateOrganization(ctx domain.RequestContext, org org.Organization) (err error)

UpdateOrganization updates the given organization record in the database to the values supplied.

func (s Store) UploadLogo(ctx domain.RequestContext, logo []byte) (err error)

UploadLogo saves custom logo to the organization record.

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
f or F : Jump to identifier