Back to godoc.org
go.mozilla.org/person-api

package person_api

v0.0.0 (e07ecb5)
Latest Go to latest
Published: Nov 25, 2019 | License: MPL-2.0 | Module: go.mozilla.org/person-api

Index

Constants

const (
	USERID           getMethod = 0
	UUID             getMethod = 1
	PRIMARY_EMAIL    getMethod = 2
	PRIMARY_USERNAME getMethod = 3
)
const (
	GET_ALL              listMethod = 0
	GET_ALL_ACTIVE_STAFF listMethod = 1
)

type AccessInformationValuesArray

type AccessInformationValuesArray struct {
	AccessProvider AccessProviderAttribute `json:"access_provider"`
	Hris           HrisAttribute           `json:"hris"`
	LDAP           LDAPAttribute           `json:"ldap"`
	Mozilliansorg  MozilliansorgAttribute  `json:"mozilliansorg"`
}

type AccessProviderAttribute

type AccessProviderAttribute struct {
	Metadata  AccessProviderMetadata `json:"metadata"`
	Signature Signature              `json:"signature"`
	Values    map[string]interface{} `json:"values"`
}

type AccessProviderMetadata

type AccessProviderMetadata struct {
	Display        interface{}    `json:"display"`
	Classification Classification `json:"classification"`
	Created        string         `json:"created"`
	LastModified   string         `json:"last_modified"`
	Verified       bool           `json:"verified"`
}

type Alg

type Alg string
const (
	Ed25519 Alg = "ED25519"
	Hs256   Alg = "HS256"
	RSA     Alg = "RSA"
	Rs256   Alg = "RS256"
)

type AuthReq

type AuthReq struct {
	Audience     string `json:"audience"`
	Scope        string `json:"scope"`
	GrantType    string `json:"grant_type"`
	ClientId     string `json:"client_id"`
	ClientSecret string `json:"client_secret"`
}

type AuthResp

type AuthResp struct {
	AccessToken string `json:"access_token"`
	Scope       string `json:"scope"`
	ExpiresIn   int    `json:"expires_in"`
	TokenType   string `json:"token_type"`
}

type Classification

type Classification string
const (
	WORKGROUPCONFIDENTIALSTAFFONLY Classification = "WORKGROUP CONFIDENTIAL: STAFF ONLY"
	WORKGROUPCONFIDENTIAL          Classification = "WORKGROUP CONFIDENTIAL"
	IndividualConfidential         Classification = "INDIVIDUAL CONFIDENTIAL"
	MozillaConfidential            Classification = "MOZILLA CONFIDENTIAL"
	PUBLIC                         Classification = "PUBLIC"
)

type Client

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

func NewClient

func NewClient(id, secret, baseUrl, authUrl string) (*Client, error)

func (*Client) GetAccessToken

func (c *Client) GetAccessToken(authUrl string) (string, error)

func (*Client) GetAllActiveStaff

func (c *Client) GetAllActiveStaff() ([]*Person, error)

func (*Client) GetAllUsers

func (c *Client) GetAllUsers() ([]*Person, error)

func (*Client) GetPersonByEmail

func (c *Client) GetPersonByEmail(primaryEmail string) (*Person, error)

func (*Client) GetPersonByUUID

func (c *Client) GetPersonByUUID(uuid string) (*Person, error)

func (*Client) GetPersonByUserId

func (c *Client) GetPersonByUserId(userid string) (*Person, error)

func (*Client) GetPersonByUsername

func (c *Client) GetPersonByUsername(primaryUsername string) (*Person, error)

func (*Client) GetPersonsInGroups

func (c *Client) GetPersonsInGroups(groups []string) ([]*Person, error)

func (*Client) RefreshAccessToken

func (c *Client) RefreshAccessToken() error

type DinoParkDisplay

type DinoParkDisplay string
const (
	Authenticated DinoParkDisplay = "authenticated"
	Ndaed         DinoParkDisplay = "ndaed"
	Private       DinoParkDisplay = "private"
	Staff         DinoParkDisplay = "staff"
	Vouched       DinoParkDisplay = "vouched"
	Public        DinoParkDisplay = "public"
)

type HrisAttribute

type HrisAttribute struct {
	Metadata  Metadata               `json:"metadata"`
	Signature Signature              `json:"signature"`
	Values    map[string]interface{} `json:"values"`
}

type IdentitiesAttributesValuesArray

type IdentitiesAttributesValuesArray struct {
	BugzillaMozillaOrgID           *StandardAttributeString `json:"bugzilla_mozilla_org_id,omitempty"`
	BugzillaMozillaOrgPrimaryEmail *StandardAttributeString `json:"bugzilla_mozilla_org_primary_email,omitempty"`
	Custom1_PrimaryEmail           *StandardAttributeString `json:"custom_1_primary_email,omitempty"`
	Custom2_PrimaryEmail           *StandardAttributeString `json:"custom_2_primary_email,omitempty"`
	Custom3_PrimaryEmail           *StandardAttributeString `json:"custom_3_primary_email,omitempty"`
	FirefoxAccountsID              *StandardAttributeString `json:"firefox_accounts_id,omitempty"`
	FirefoxAccountsPrimaryEmail    *StandardAttributeString `json:"firefox_accounts_primary_email,omitempty"`
	GithubIDV3                     *StandardAttributeString `json:"github_id_v3,omitempty"`
	GithubIDV4                     *StandardAttributeString `json:"github_id_v4,omitempty"`
	GithubPrimaryEmail             *StandardAttributeString `json:"github_primary_email,omitempty"`
	GoogleOauth2ID                 *StandardAttributeString `json:"google_oauth2_id,omitempty"`
	GooglePrimaryEmail             *StandardAttributeString `json:"google_primary_email,omitempty"`
	MozillaLDAPID                  *StandardAttributeString `json:"mozilla_ldap_id,omitempty"`
	MozillaLDAPPrimaryEmail        *StandardAttributeString `json:"mozilla_ldap_primary_email,omitempty"`
	MozillaPOSIXID                 *StandardAttributeString `json:"mozilla_posix_id,omitempty"`
	MozilliansorgID                *StandardAttributeString `json:"mozilliansorg_id,omitempty"`
}

type LDAPAttribute

type LDAPAttribute struct {
	Metadata  Metadata               `json:"metadata"`
	Signature Signature              `json:"signature"`
	Values    map[string]interface{} `json:"values"`
}

type Metadata

type Metadata struct {
	Classification Classification  `json:"classification"`
	Created        string          `json:"created"`
	Display        DinoParkDisplay `json:"display"`
	LastModified   string          `json:"last_modified"`
	Verified       bool            `json:"verified"`
}

type MozilliansorgAttribute

type MozilliansorgAttribute struct {
	Metadata  Metadata               `json:"metadata"`
	Signature Signature              `json:"signature"`
	Values    map[string]interface{} `json:"values"`
}

type Person

type Person struct {
	AccessInformation AccessInformationValuesArray    `json:"access_information"`
	Active            StandardAttributeBoolean        `json:"active"`
	AlternativeName   StandardAttributeString         `json:"alternative_name"`
	Created           StandardAttributeString         `json:"created"`
	Description       StandardAttributeString         `json:"description"`
	FirstName         StandardAttributeString         `json:"first_name"`
	FunTitle          StandardAttributeString         `json:"fun_title"`
	Identities        IdentitiesAttributesValuesArray `json:"identities"`
	Languages         StandardAttributeValues         `json:"languages"`
	LastModified      StandardAttributeString         `json:"last_modified"`
	LastName          StandardAttributeString         `json:"last_name"`
	Location          StandardAttributeString         `json:"location"`
	LoginMethod       StandardAttributeString         `json:"login_method"`
	PGPPublicKeys     StandardAttributeValues         `json:"pgp_public_keys"`
	PhoneNumbers      StandardAttributeValues         `json:"phone_numbers"`
	Picture           StandardAttributeString         `json:"picture"`
	PrimaryEmail      StandardAttributeString         `json:"primary_email"`
	PrimaryUsername   StandardAttributeString         `json:"primary_username"`
	Pronouns          StandardAttributeString         `json:"pronouns"`
	Schema            string                          `json:"schema"`
	SSHPublicKeys     StandardAttributeValues         `json:"ssh_public_keys"`
	StaffInformation  StaffInformationValuesArray     `json:"staff_information"`
	Tags              StandardAttributeValues         `json:"tags"`
	Timezone          StandardAttributeString         `json:"timezone"`
	Uris              StandardAttributeValues         `json:"uris"`
	UserID            StandardAttributeString         `json:"user_id"`
	Usernames         StandardAttributeValues         `json:"usernames"`
	UUID              StandardAttributeString         `json:"uuid"`
}

func UnmarshalPerson

func UnmarshalPerson(data []byte) (Person, error)

func (*Person) GetLDAPUsername

func (p *Person) GetLDAPUsername() string

func (*Person) GetPGPPublicKeys

func (p *Person) GetPGPPublicKeys() []string

func (*Person) GetSSHPublicKeys

func (p *Person) GetSSHPublicKeys() []string

func (*Person) Marshal

func (r *Person) Marshal() ([]byte, error)

type Publisher

type Publisher struct {
	Alg   Alg                `json:"alg"`
	Name  PublisherAuthority `json:"name"`
	Typ   Typ                `json:"typ"`
	Value string             `json:"value"`
}

type PublisherAuthority

type PublisherAuthority string
const (
	AccessProvider PublisherAuthority = "access_provider"
	Cis            PublisherAuthority = "cis"
	Hris           PublisherAuthority = "hris"
	LDAP           PublisherAuthority = "ldap"
	Mozilliansorg  PublisherAuthority = "mozilliansorg"
)

type PublisherLax

type PublisherLax struct {
	Alg   Alg     `json:"alg"`
	Name  *string `json:"name"`
	Typ   Typ     `json:"typ"`
	Value string  `json:"value"`
}

type Signature

type Signature struct {
	Additional []PublisherLax `json:"additional"`
	Publisher  Publisher      `json:"publisher"`
}

type StaffInformationValuesArray

type StaffInformationValuesArray struct {
	CostCenter     StandardAttributeString  `json:"cost_center"`
	Director       StandardAttributeBoolean `json:"director"`
	Manager        StandardAttributeBoolean `json:"manager"`
	OfficeLocation StandardAttributeString  `json:"office_location"`
	Staff          StandardAttributeBoolean `json:"staff"`
	Team           StandardAttributeString  `json:"team"`
	Title          StandardAttributeString  `json:"title"`
	WorkerType     StandardAttributeString  `json:"worker_type"`
	WprDeskNumber  StandardAttributeString  `json:"wpr_desk_number"`
}

type StandardAttributeBoolean

type StandardAttributeBoolean struct {
	Metadata  Metadata  `json:"metadata"`
	Signature Signature `json:"signature"`
	Value     bool      `json:"value"`
}

type StandardAttributeString

type StandardAttributeString struct {
	Metadata  Metadata  `json:"metadata"`
	Signature Signature `json:"signature"`
	Value     string    `json:"value"`
}

type StandardAttributeValues

type StandardAttributeValues struct {
	Metadata  Metadata    `json:"metadata"`
	Signature Signature   `json:"signature"`
	Values    interface{} `json:"values"`
}

type Typ

type Typ string
const (
	Jws Typ = "JWS"
	PGP Typ = "PGP"
)
Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier