organization

package
v0.0.0-...-d3d53d6 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2016 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitModels

func InitModels()

InitModels initialize models in mongo, if required.

Types

type Invitation

type Invitation struct {
	Created db.DateTime `json:"created"`
	Role    string      `json:"role"`
	User    string      `json:"user"`
}

type Last2FAManager

type Last2FAManager struct {
	// contains filtered or unexported fields
}

Last2FAManager is used to save the date for the last 2FA login for an organization through the authorization code grant flow

func NewLast2FAManager

func NewLast2FAManager(r *http.Request) *Last2FAManager

NewLast2FAManager creates and initializes a new Last2FAManager

func (*Last2FAManager) Exists

func (m *Last2FAManager) Exists(globalID string, username string) bool

Exists checks if an organization - user combination entry exists.

func (*Last2FAManager) GetLast2FA

func (m *Last2FAManager) GetLast2FA(globalID string, username string) (db.DateTime, error)

GetLast2FA Gets the date of the last successful 2FA login, if no failed login attempts have occurred since then

func (*Last2FAManager) RemoveByOrganization

func (m *Last2FAManager) RemoveByOrganization(globalid string) error

Remove the Last2FA entries for this organization

func (*Last2FAManager) RemoveByUser

func (m *Last2FAManager) RemoveByUser(username string) error

Remove the Last2FA entries for this user

func (*Last2FAManager) RemoveLast2FA

func (m *Last2FAManager) RemoveLast2FA(globalID string, username string) error

RemoveLast2FA Removes the entry of the last successful 2FA login for this organization - user combination

func (*Last2FAManager) SetLast2FA

func (m *Last2FAManager) SetLast2FA(globalID string, username string) error

SetLast2FA Set the last successful 2FA time

type LogoManager

type LogoManager struct {
	// contains filtered or unexported fields
}

LogoManager is used to save the logo for an organization

func NewLogoManager

func NewLogoManager(r *http.Request) *LogoManager

NewLogoManager creates and initializes a new LogoManager

func (*LogoManager) Create

func (m *LogoManager) Create(organization *Organization) error

Create a new organization entry in the organization logo collection

func (*LogoManager) Exists

func (m *LogoManager) Exists(globalID string) bool

Exists checks if an organization and logo entry exists.

func (*LogoManager) GetByName

func (m *LogoManager) GetByName(globalID string) (organization *Organization, err error)
func (m *LogoManager) GetLogo(globalID string) (string, error)

GetLogo Gets the logo from an organization

func (*LogoManager) Remove

func (m *LogoManager) Remove(globalid string) error

Remove the organization logo

func (m *LogoManager) RemoveLogo(globalID string) error

RemoveLogo Removes the logo from an organization

func (m *LogoManager) SaveLogo(globalID string, logo string) (*mgo.ChangeInfo, error)

SaveLogo save or update logo

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager is used to store organizations

func NewManager

func NewManager(r *http.Request) *Manager

NewManager creates and initializes a new Manager

func (*Manager) AddDNS

func (m *Manager) AddDNS(organization *Organization, dnsName string) error

func (*Manager) AllByOrg

func (m *Manager) AllByOrg(globalID string) ([]Organization, error)

AllByOrg get organizations where certain organization is a member/owner.

func (*Manager) AllByUser

func (m *Manager) AllByUser(username string) ([]Organization, error)

AllByUser get organizations for certain user.

func (*Manager) CountByOrganization

func (m *Manager) CountByOrganization(organization string) (int, error)

CountByOrganization counts the amount of organizations where the organization is an owner

func (*Manager) CountByUser

func (m *Manager) CountByUser(username string) (int, error)

CountByUser counts the amount of organizations by user

func (*Manager) Create

func (m *Manager) Create(organization *Organization) error

Create a new organization.

func (*Manager) Exists

func (m *Manager) Exists(globalID string) bool

Exists checks if an organization exists.

func (*Manager) Get

func (m *Manager) Get(id string) (*Organization, error)

Get organization by ID.

func (*Manager) GetByName

func (m *Manager) GetByName(globalID string) (organization *Organization, err error)

GetByName gets an organization by Name.

func (*Manager) GetOrganizations

func (m *Manager) GetOrganizations(organizationIDs []string) ([]Organization, error)

GetOrganizations gets a list of organizations.

func (*Manager) GetSubOrganizations

func (m *Manager) GetSubOrganizations(globalID string) ([]Organization, error)

GetSubOrganizations returns all organizations which have {globalID} as parent (including the organization with {globalID} as globalid) TODO: validate globalID since it is appended in the query TODO: put an index on the globalid field

func (*Manager) GetValidity

func (m *Manager) GetValidity(globalID string) (int, error)

GetValidity gets the 2FA validity duration in seconds

func (*Manager) IsMember

func (m *Manager) IsMember(globalID, username string) (result bool, err error)

IsMember checks if a specific user is in the members list of an organization or belongs to an organization that is in the member list

func (*Manager) IsOwner

func (m *Manager) IsOwner(globalID, username string) (isowner bool, err error)

IsOwner checks if a specific user is in the owners list of an organization or belongs to an organization that is in the owner list It also checks this for the parentorganizations

func (*Manager) OrganizationIsMember

func (m *Manager) OrganizationIsMember(globalID, organization string) (ismember bool, err error)

OrganizationIsMember checks if organization2 is a member of organization1

func (*Manager) OrganizationIsOwner

func (m *Manager) OrganizationIsOwner(globalID, organization string) (isowner bool, err error)

OrganizationIsOwner checks if organization2 is an owner of organization1

func (*Manager) OrganizationIsPartOf

func (m *Manager) OrganizationIsPartOf(globalID, organization string) (ispart bool, err error)

OrganizationIsPartOf checks if organization2 is a member or an owner of organization1

func (*Manager) Remove

func (m *Manager) Remove(globalid string) error

Remove removes the organization

func (*Manager) RemoveDNS

func (m *Manager) RemoveDNS(organization *Organization, dns string) error

RemoveDNS remove DNS

func (*Manager) RemoveMember

func (m *Manager) RemoveMember(organization *Organization, username string) error

RemoveMember remove member

func (*Manager) RemoveOrgMember

func (m *Manager) RemoveOrgMember(organization *Organization, organizationID string) error

RemoveOrgMember remove organization member

func (*Manager) RemoveOrgOwner

func (m *Manager) RemoveOrgOwner(organization *Organization, organizationID string) error

RemoveOrgOwner remove owner

func (*Manager) RemoveOrganization

func (m *Manager) RemoveOrganization(globalID string, organization string) error

RemoveOrganization Removes an organization as member or owner from another organization

func (*Manager) RemoveOwner

func (m *Manager) RemoveOwner(organization *Organization, owner string) error

RemoveOwner remove owner

func (*Manager) RemoveUser

func (m *Manager) RemoveUser(globalID string, username string) error

RemoveUser Removes a user from an organization

func (*Manager) Save

func (m *Manager) Save(organization *Organization) error

Save an organization.

func (*Manager) SaveMember

func (m *Manager) SaveMember(organization *Organization, username string) error

SaveMember save or update member

func (*Manager) SaveOrgMember

func (m *Manager) SaveOrgMember(organization *Organization, organizationID string) error

SaveOrgMember save or update organization member

func (*Manager) SaveOrgOwner

func (m *Manager) SaveOrgOwner(organization *Organization, organizationID string) error

SaveOrgOwner save or update owners

func (*Manager) SaveOwner

func (m *Manager) SaveOwner(organization *Organization, owner string) error

SaveOwner save or update owners

func (*Manager) SetValidity

func (m *Manager) SetValidity(globalID string, secondsDuration int) error

func (*Manager) UpdateDNS

func (m *Manager) UpdateDNS(organization *Organization, oldDNSName string, newDNSName string) error

func (*Manager) UpdateMembership

func (m *Manager) UpdateMembership(globalid string, username string, oldrole string, newrole string) error

UpdateMembership Updates a user his role in an organization

func (*Manager) UpdateOrgMembership

func (m *Manager) UpdateOrgMembership(globalid string, organization string, oldrole string, newrole string) error

UpdateOrgMembership Updates an organizstion role in another organization

type Organization

type Organization struct {
	DNS             []string `json:"dns"`
	Globalid        string   `json:"globalid"`
	Members         []string `json:"members"`
	Owners          []string `json:"owners"`
	PublicKeys      []string `json:"publicKeys"`
	SecondsValidity int      `json:"secondsvalidity"`
	OrgOwners       []string `json:"orgowners"`  //OrgOwners are other organizations that are owner of this organization
	OrgMembers      []string `json:"orgmembers"` //OrgMembers are other organizations that are member of this organization
}

func (*Organization) IsValid

func (c *Organization) IsValid() (valid bool)

IsValid performs basic validation on the content of an organizations fields TODO: globalid should not contain ':,.'

type OrganizationLogo struct {
	Globalid string `json:"globalid"`
}

type UserLast2FALogin

type UserLast2FALogin struct {
	Globalid string      `json:"globalid"`
	Username string      `json:"username"`
	Last2FA  db.DateTime `json:"last2fa"`
}

Jump to

Keyboard shortcuts

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