Documentation ¶
Index ¶
- func InitModels()
- type Invitation
- type Last2FAManager
- func (m *Last2FAManager) Exists(globalID string, username string) bool
- func (m *Last2FAManager) GetLast2FA(globalID string, username string) (db.DateTime, error)
- func (m *Last2FAManager) RemoveByOrganization(globalid string) error
- func (m *Last2FAManager) RemoveByUser(username string) error
- func (m *Last2FAManager) RemoveLast2FA(globalID string, username string) error
- func (m *Last2FAManager) SetLast2FA(globalID string, username string) error
- type LogoManager
- func (m *LogoManager) Create(organization *Organization) error
- func (m *LogoManager) Exists(globalID string) bool
- func (m *LogoManager) GetByName(globalID string) (organization *Organization, err error)
- func (m *LogoManager) GetLogo(globalID string) (string, error)
- func (m *LogoManager) Remove(globalid string) error
- func (m *LogoManager) RemoveLogo(globalID string) error
- func (m *LogoManager) SaveLogo(globalID string, logo string) (*mgo.ChangeInfo, error)
- type Manager
- func (m *Manager) AddDNS(organization *Organization, dnsName string) error
- func (m *Manager) AllByOrg(globalID string) ([]Organization, error)
- func (m *Manager) AllByUser(username string) ([]Organization, error)
- func (m *Manager) CountByOrganization(organization string) (int, error)
- func (m *Manager) CountByUser(username string) (int, error)
- func (m *Manager) Create(organization *Organization) error
- func (m *Manager) Exists(globalID string) bool
- func (m *Manager) Get(id string) (*Organization, error)
- func (m *Manager) GetByName(globalID string) (organization *Organization, err error)
- func (m *Manager) GetOrganizations(organizationIDs []string) ([]Organization, error)
- func (m *Manager) GetSubOrganizations(globalID string) ([]Organization, error)
- func (m *Manager) GetValidity(globalID string) (int, error)
- func (m *Manager) IsMember(globalID, username string) (result bool, err error)
- func (m *Manager) IsOwner(globalID, username string) (isowner bool, err error)
- func (m *Manager) OrganizationIsMember(globalID, organization string) (ismember bool, err error)
- func (m *Manager) OrganizationIsOwner(globalID, organization string) (isowner bool, err error)
- func (m *Manager) OrganizationIsPartOf(globalID, organization string) (ispart bool, err error)
- func (m *Manager) Remove(globalid string) error
- func (m *Manager) RemoveDNS(organization *Organization, dns string) error
- func (m *Manager) RemoveMember(organization *Organization, username string) error
- func (m *Manager) RemoveOrgMember(organization *Organization, organizationID string) error
- func (m *Manager) RemoveOrgOwner(organization *Organization, organizationID string) error
- func (m *Manager) RemoveOrganization(globalID string, organization string) error
- func (m *Manager) RemoveOwner(organization *Organization, owner string) error
- func (m *Manager) RemoveUser(globalID string, username string) error
- func (m *Manager) Save(organization *Organization) error
- func (m *Manager) SaveMember(organization *Organization, username string) error
- func (m *Manager) SaveOrgMember(organization *Organization, organizationID string) error
- func (m *Manager) SaveOrgOwner(organization *Organization, organizationID string) error
- func (m *Manager) SaveOwner(organization *Organization, owner string) error
- func (m *Manager) SetValidity(globalID string, secondsDuration int) error
- func (m *Manager) UpdateDNS(organization *Organization, oldDNSName string, newDNSName string) error
- func (m *Manager) UpdateMembership(globalid string, username string, oldrole string, newrole string) error
- func (m *Manager) UpdateOrgMembership(globalid string, organization string, oldrole string, newrole string) error
- type Organization
- type OrganizationLogo
- type UserLast2FALogin
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Invitation ¶
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 ¶
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 (*LogoManager) GetLogo ¶
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 (*LogoManager) RemoveLogo ¶
func (m *LogoManager) RemoveLogo(globalID string) error
RemoveLogo Removes the logo from an organization
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager is used to store organizations
func NewManager ¶
NewManager creates and initializes a new Manager
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 ¶
CountByOrganization counts the amount of organizations where the organization is an owner
func (*Manager) CountByUser ¶
CountByUser counts the amount of organizations by user
func (*Manager) Create ¶
func (m *Manager) Create(organization *Organization) error
Create a new organization.
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 ¶
GetValidity gets the 2FA validity duration in seconds
func (*Manager) IsMember ¶
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 ¶
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 ¶
OrganizationIsMember checks if organization2 is a member of organization1
func (*Manager) OrganizationIsOwner ¶
OrganizationIsOwner checks if organization2 is an owner of organization1
func (*Manager) OrganizationIsPartOf ¶
OrganizationIsPartOf checks if organization2 is a member or an owner of organization1
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 ¶
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 ¶
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 (*Manager) UpdateDNS ¶
func (m *Manager) UpdateDNS(organization *Organization, oldDNSName string, newDNSName string) error
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 ':,.'