Documentation ¶
Index ¶
- Constants
- func Configure(api *operations.ClaAPI, service SignatureService, ...)
- func NewBadRequestError(text string) error
- func NewForbiddenError(text string) error
- type ActivePullRequest
- type ApprovalCriteria
- type ApprovalList
- type BadRequestError
- type ClaManagerInfoParams
- type DBManagersModel
- type DBSignatureMetadata
- type DBSignatureUsersModel
- type EmployeeModel
- type ForbiddenError
- type GerritUserResponse
- type ICLAUserResponse
- type InvalidateSignatureTemplateParams
- type ItemSignature
- type SignatureCompanyID
- type SignatureDynamoDB
- type SignatureRepository
- type SignatureService
Constants ¶
const ( //InvalidateCCLAICLASignatureTemplateName is email template for InvalidateSignatureTemplate InvalidateCCLAICLASignatureTemplateName = "InvalidateSignatureTemplate" //InvalidateCCLAICLASignatureTemplate ... InvalidateCCLAICLASignatureTemplate = `` /* 771-byte string literal not displayed */ //InvalidateCCLASignatureTemplateName is email template upon approval list removal for ccla use case InvalidateCCLASignatureTemplateName = "InvalidateCCLAICLASignatureTemplate" //InvalidateCCLASignatureTemplate ... InvalidateCCLASignatureTemplate = `` /* 692-byte string literal not displayed */ //InvalidateICLASignatureTemplateName is email template upon approval list removal for ccla use case InvalidateICLASignatureTemplateName = "InvalidateICLASignatureTemplate" //InvalidateICLASignatureTemplate ... InvalidateICLASignatureTemplate = `` /* 698-byte string literal not displayed */ //InvalidateCCLAICLAECLASignatureTemplateName is email template upon approval list removal for ccla use case InvalidateCCLAICLAECLASignatureTemplateName = "InvalidateCCLAICLAECLASignatureTemplate" //InvalidateCCLAICLAECLASignatureTemplate ... InvalidateCCLAICLAECLASignatureTemplate = `` /* 791-byte string literal not displayed */ )
const ( //CCLAICLA representing user removal under CCLA + ICLA CCLAICLA = "CCLAICLA" //CCLAICLAECLA representing user removal under CCLA + ICLA +ECLA CCLAICLAECLA = "CCLAICLAECLA" //CCLA representing normal use case of user under CCLA CCLA = "ICLA" //ICLA representing individual use case ICLA = "ICLA" )
const ( LoadACLDetails = true DontLoadACLDetails = false SignatureProjectIDIndex = "project-signature-index" SignatureProjectDateIDIndex = "project-signature-date-index" SignatureProjectReferenceIndex = "signature-project-reference-index" SignatureProjectIDSigTypeSignedApprovedIDIndex = "signature-project-id-sigtype-signed-approved-id-index" SignatureProjectIDTypeIndex = "signature-project-id-type-index" SignatureReferenceIndex = "reference-signature-index" SignatureReferenceSearchIndex = "reference-signature-search-index" HugePageSize = 10000 DefaultPageSize = 100 BigPageSize = 500 )
constants
const SignatureDomainApprovalListColumn = "domain_whitelist" // TODO: rename column to domain_approval_list
SignatureDomainApprovalListColumn is the name of the signature column for the domain approval list
const SignatureEmailApprovalListColumn = "email_whitelist" // TODO: rename column to email_approval_list
SignatureEmailApprovalListColumn is the name of the signature column for the email approval list
const SignatureGitHubOrgApprovalListColumn = "github_org_whitelist" // TODO: rename column to github_org_approval_list
SignatureGitHubOrgApprovalListColumn is the name of the signature column for the GitHub organization approval list
const SignatureGitHubUsernameApprovalListColumn = "github_whitelist" // TODO: rename column to github_username_approval_list
SignatureGitHubUsernameApprovalListColumn is the name of the signature column for the GitHub username approval list
const SignatureGitlabOrgApprovalListColumn = "gitlab_org_approval_list" // nolint G101: Potential hardcoded credentials (gosec)
SignatureGitlabOrgApprovalListColumn is the name of the signature column for gitlab organization approval lists
const SignatureGitlabUsernameApprovalListColumn = "gitlab_username_approval_list"
SignatureGitlabUsernameApprovalListColumn is the name of the signature column for gitlab username approval lists
const SignatureUserGitHubUsername = "user_github_username"
SignatureUserGitHubUsername is the name of the signature column for user gitlab username
const SignatureUserGitlabUsername = "user_gitlab_username"
SignatureUserGitlabUsername is the name of the signature column for user gitlab username
Variables ¶
This section is empty.
Functions ¶
func Configure ¶
func Configure(api *operations.ClaAPI, service SignatureService, sessionStore *dynastore.Store, eventsService events.Service)
Configure setups handlers on api with service
func NewBadRequestError ¶
NewBadRequestError returns an error that formats as the given text.
func NewForbiddenError ¶
NewForbiddenError returns an error that formats as the given text.
Types ¶
type ActivePullRequest ¶
type ActivePullRequest struct { GitHubAuthorUsername string `json:"github_author_username"` GitHubAuthorEmail string `json:"github_author_email"` CLAGroupID string `json:"cla_group_id"` RepositoryID string `json:"repository_id"` PullRequestID string `json:"pull_request_id"` }
ActivePullRequest data model
type ApprovalCriteria ¶
ApprovalCriteria struct representing approval criteria values
type ApprovalList ¶
type ApprovalList struct { Criteria string ApprovalList []string Action string ClaGroupID string ClaGroupName string CompanyID string Version string EmailApprovals []string DomainApprovals []string GitHubUsernameApprovals []string GitHubUsernames []string GitHubOrgApprovals []string GitlabUsernameApprovals []string GitlabOrgApprovals []string GitlabUsernames []string GerritICLAECLAs []string ICLAs []*models.IclaSignature ECLAs []*models.Signature CLAManager *models.User ManagersInfo []ClaManagerInfoParams CCLASignature *models.Signature }
ApprovalList data model
type BadRequestError ¶
type BadRequestError struct {
// contains filtered or unexported fields
}
BadRequestError is a trivial implementation of error.
func (BadRequestError) Error ¶
func (e BadRequestError) Error() string
Error is the to string method for an error
type ClaManagerInfoParams ¶
ClaManagerInfoParams represents the CLAManagerInfo used inside of the Email Templates
type DBManagersModel ¶
type DBManagersModel struct { SignatureID string `json:"signature_id"` SignatureACL []string `json:"signature_acl"` }
DBManagersModel is a database model for only the ACL/Manager column
type DBSignatureMetadata ¶
type DBSignatureMetadata struct { Key string `json:"key"` Expire int64 `json:"expire"` Value string `json:"value"` }
DBSignatureMetadata is a database model for the key and value fields for a given signature
type DBSignatureUsersModel ¶
type DBSignatureUsersModel struct { SignatureID string `json:"signature_id"` UserID string `json:"signature_reference_id"` }
DBSignatureUsersModel is a database model for only the signature ID and signature_reference_id fields
type ForbiddenError ¶
type ForbiddenError struct {
// contains filtered or unexported fields
}
ForbiddenError is a trivial implementation of error.
func (ForbiddenError) Error ¶
func (e ForbiddenError) Error() string
Error is the to string method for an error
type GerritUserResponse ¶
type GerritUserResponse struct { Error error // contains filtered or unexported fields }
GerritUserResponse is a data structure to hold the gerrit user query response
type ICLAUserResponse ¶
type ICLAUserResponse struct { ICLASignature *models.IclaSignature Error error }
ICLAUserResponse is struct that supports ICLAUsers
type InvalidateSignatureTemplateParams ¶
type InvalidateSignatureTemplateParams struct { RecipientName string ClaType string ClaManager string RemovalCriteria string ProjectName string ProjectManager string CLAManagers []ClaManagerInfoParams CLaManager string CLAGroupName string Company string }
InvalidateSignatureTemplateParams representing params when invalidating icla/ecla
type ItemSignature ¶
type ItemSignature struct { SignatureID string `json:"signature_id"` // No omitempty, always included DateCreated string `json:"date_created,omitempty"` DateModified string `json:"date_modified,omitempty"` SignatureApproved bool `json:"signature_approved,omitempty"` SignatureSigned bool `json:"signature_signed"` SignatureDocumentMajorVersion int `json:"signature_document_major_version,omitempty"` SignatureDocumentMinorVersion int `json:"signature_document_minor_version,omitempty"` SignatureSignURL string `json:"signature_sign_url,omitempty"` SignatureReturnURL string `json:"signature_return_url,omitempty"` SignatureReturnURLType string `json:"signature_return_url_type,omitempty"` SignatureCallbackURL string `json:"signature_callback_url,omitempty"` SignatureReferenceID string `json:"signature_reference_id,omitempty"` SignatureReferenceName string `json:"signature_reference_name,omitempty"` SignatureReferenceNameLower string `json:"signature_reference_name_lower,omitempty"` SignatureProjectID string `json:"signature_project_id,omitempty"` SignatureReferenceType string `json:"signature_reference_type,omitempty"` SignatureType string `json:"signature_type,omitempty"` SignatureEnvelopeID string `json:"signature_envelope_id,omitempty"` SignatureUserCompanyID string `json:"signature_user_ccla_company_id,omitempty"` EmailApprovalList []string `json:"email_whitelist,omitempty"` EmailDomainApprovalList []string `json:"domain_whitelist,omitempty"` GitHubUsernameApprovalList []string `json:"github_whitelist,omitempty"` GitHubOrgApprovalList []string `json:"github_org_whitelist,omitempty"` GitlabUsernameApprovalList []string `json:"gitlab_username_approval_list,omitempty"` GitlabOrgApprovalList []string `json:"gitlab_org_approval_list,omitempty"` SignatureACL []string `json:"signature_acl,omitempty"` UserGithubID string `json:"user_github_id,omitempty"` UserGithubUsername string `json:"user_github_username,omitempty"` UserGitlabID string `json:"user_gitlab_id,omitempty"` UserGitlabUsername string `json:"user_gitlab_username,omitempty"` UserLFUsername string `json:"user_lf_username,omitempty"` UserName string `json:"user_name,omitempty"` UserEmail string `json:"user_email,omitempty"` SigtypeSignedApprovedID string `json:"sigtype_signed_approved_id,omitempty"` SignedOn string `json:"signed_on,omitempty"` SignatoryName string `json:"signatory_name,omitempty"` UserDocusignName string `json:"user_docusign_name,omitempty"` UserDocusignDateSigned string `json:"user_docusign_date_signed,omitempty"` AutoCreateECLA bool `json:"auto_create_ecla,omitempty"` UserDocusignRawXML string `json:"user_docusign_raw_xml,omitempty"` }
ItemSignature database model
type SignatureCompanyID ¶
type SignatureCompanyID struct { SignatureID string CompanyID string CompanySFID string CompanyName string }
SignatureCompanyID is a simple data model to hold the signature ID and come company details for CCLA's
type SignatureDynamoDB ¶
type SignatureDynamoDB struct { SignatureID string `json:"signature_id"` // PK SignatureProjectID string `json:"signature_project_id"` // the signature CLA group ID SignatureReferenceID string `json:"signature_reference_id"` // value is user_id for icla/ecla, value is company_id for ccla SignatureType string `json:"signature_type"` // one of: cla, ccla SignatureACL []string `json:"signature_acl"` // [github:1234567] SignatureApproved bool `json:"signature_approved"` // true if the signature is approved, false if revoked/invalidated SignatureSigned bool `json:"signature_signed"` // true if the signature has been signed SignatureReferenceType string `json:"signature_reference_type"` // one of: user, company SignatureReferenceName string `json:"signature_reference_name"` // John Doe SignatureReferenceNameLower string `json:"signature_reference_name_lower"` // john doe SignatureUserCCLACompanyID string `json:"signature_user_ccla_company_id"` // set for ECLA record types, null/missing otherwise SignatureReturnURL string `json:"signature_return_url"` // e.g https://github.com/open-telemetry/opentelemetry-go/pull/1751 SignatureDocumentMajorVersion int `json:"signature_document_major_version"` // 2 SignatureDocumentMinorVersion int `json:"signature_document_minor_version"` // 0 SigTypeSignedApprovedID string `json:"sig_type_signed_approved_id"` // e.g. ecla#true#true#e908aefe-27ff-44ea-9f06-ab513f34cb1d SignedOn string `json:"signed_on"` // 2021-03-29T22:48:10.246463+0000 AutoCreateECLA bool `json:"auto_create_ecla"` // flag to indicate if auto-create ECLA feature is enabled (only applies to CCLA signature record types) ProjectID string `json:"project_id"` ProjectName string `json:"project_name"` ProjectSFID string `json:"project_sfid"` CompanyID string `json:"company_id"` CompanyName string `json:"company_name"` CompanySFID string `json:"company_sfid"` UserName string `json:"user_name"` UserEmail string `json:"user_email"` UserLFUsername string `json:"user_lf_username"` UserGitHubUsername string `json:"user_github_username"` UserGitLabUsername string `json:"user_gitlab_username"` DateCreated string `json:"date_created"` // 2021-03-29T22:48:10.246463+0000 DateModified string `json:"date_modified"` // 2021-08-23T22:33:03.798606+0000 Note string `json:"note"` Version string `json:"version"` // v1 }
SignatureDynamoDB is a data model for the signature table. Most of the record create/update happens in the old Python code, however, we needed to add this data model after we added the auto-enable feature for employee acknowledgements.
| Type of Signature | `project_id` |`signature_reference_type`|`signature_type`|`signature_reference_id`|`signature_user_ccla_company_id`| PDF? | Auto Create ECLA Flag | |:-----------------------|:-------------------|:-------------------------|:---------------|:-----------------------|:-------------------------------|------|-----------------------| | ICLA (individual) | <valid_project_id> | user | cla | <user_id_value> | null/empty | Yes | No | | CCLA/ECLA (employee) | <valid_project_id> | user | cla | <user_id_value> | <company_id_value> | No | Yes | | CCLA (CLA Manager) | <valid_project_id> | company | ccla | <company_id_value> | null/empty | Yes | No |
type SignatureRepository ¶
type SignatureRepository interface { GetGithubOrganizationsFromApprovalList(ctx context.Context, signatureID string) ([]models.GithubOrg, error) AddGithubOrganizationToApprovalList(ctx context.Context, signatureID, githubOrganizationID string) ([]models.GithubOrg, error) DeleteGithubOrganizationFromApprovalList(ctx context.Context, signatureID, githubOrganizationID string) ([]models.GithubOrg, error) ValidateProjectRecord(ctx context.Context, signatureID, note string) error InvalidateProjectRecord(ctx context.Context, signatureID, note string) error UpdateEnvelopeDetails(ctx context.Context, signatureID, envelopeID string, signURL *string) (*models.Signature, error) CreateSignature(ctx context.Context, signature *ItemSignature) error UpdateSignature(ctx context.Context, signatureID string, updates map[string]interface{}) error SaveOrUpdateSignature(ctx context.Context, signature *ItemSignature) error GetSignature(ctx context.Context, signatureID string) (*models.Signature, error) GetItemSignature(ctx context.Context, signatureID string) (*ItemSignature, error) GetActivePullRequestMetadata(ctx context.Context, gitHubAuthorUsername, gitHubAuthorEmail string) (*ActivePullRequest, error) GetIndividualSignature(ctx context.Context, claGroupID, userID string, approved, signed *bool) (*models.Signature, error) GetIndividualSignatures(ctx context.Context, claGroupID, userID string, approved, signed *bool) ([]*models.Signature, error) GetCorporateSignature(ctx context.Context, claGroupID, companyID string, approved, signed *bool) (*models.Signature, error) GetCorporateSignatures(ctx context.Context, claGroupID, companyID string, approved, signed *bool) ([]*models.Signature, error) GetCCLASignatures(ctx context.Context, signed, approved *bool) ([]*ItemSignature, error) GetSignatureACL(ctx context.Context, signatureID string) ([]string, error) GetProjectSignatures(ctx context.Context, params signatures.GetProjectSignaturesParams) (*models.Signatures, error) CreateProjectSummaryReport(ctx context.Context, params signatures.CreateProjectSummaryReportParams) (*models.SignatureReport, error) GetProjectCompanySignature(ctx context.Context, companyID, projectID string, approved, signed *bool, nextKey *string, pageSize *int64) (*models.Signature, error) GetProjectCompanySignatures(ctx context.Context, companyID, projectID string, approved, signed *bool, nextKey *string, sortOrder *string, pageSize *int64) (*models.Signatures, error) GetProjectCompanyEmployeeSignatures(ctx context.Context, params signatures.GetProjectCompanyEmployeeSignaturesParams, criteria *ApprovalCriteria) (*models.Signatures, error) GetProjectCompanyEmployeeSignature(ctx context.Context, companyModel *models.Company, claGroupModel *models.ClaGroup, employeeUserModel *models.User, wg *sync.WaitGroup, resultChannel chan<- *EmployeeModel, errorChannel chan<- error) CreateProjectCompanyEmployeeSignature(ctx context.Context, companyModel *models.Company, claGroupModel *models.ClaGroup, employeeUserModel *models.User) error GetCompanySignatures(ctx context.Context, params signatures.GetCompanySignaturesParams, pageSize int64, loadACL bool) (*models.Signatures, error) GetCompanyIDsWithSignedCorporateSignatures(ctx context.Context, claGroupID string) ([]SignatureCompanyID, error) GetUserSignatures(ctx context.Context, params signatures.GetUserSignaturesParams, pageSize int64, projectID *string) (*models.Signatures, error) ProjectSignatures(ctx context.Context, projectID string) (*models.Signatures, error) UpdateApprovalList(ctx context.Context, claManager *models.User, claGroupModel *models.ClaGroup, companyID string, params *models.ApprovalList, eventArgs *events.LogEventArgs) (*models.Signature, error) AddCLAManager(ctx context.Context, signatureID, claManagerID string) (*models.Signature, error) RemoveCLAManager(ctx context.Context, signatureID, claManagerID string) (*models.Signature, error) AddSigTypeSignedApprovedID(ctx context.Context, signatureID string, val string) error AddUsersDetails(ctx context.Context, signatureID string, userID string) error AddSignedOn(ctx context.Context, signatureID string) error GetClaGroupICLASignatures(ctx context.Context, claGroupID string, searchTerm *string, approved, signed *bool, pageSize int64, nextKey string, withExtraDetails bool) (*models.IclaSignatures, error) GetClaGroupCorporateContributors(ctx context.Context, claGroupID string, companyID *string, pageSize *int64, nextKey *string, searchTerm *string) (*models.CorporateContributorList, error) EclaAutoCreate(ctx context.Context, signatureID string, autoCreateECLA bool) error ActivateSignature(ctx context.Context, signatureID string) error GetICLAByDate(ctx context.Context, startDate string) ([]ItemSignature, error) }
SignatureRepository interface defines the functions for the the signature repository
func NewRepository ¶
func NewRepository(awsSession *session.Session, stage string, companyRepo company.IRepository, usersRepo users.UserRepository, eventsService events.Service, repositoriesRepo repositories.RepositoryInterface, ghOrgRepo github_organizations.RepositoryInterface, gerritService gerrits.Service, approvalRepo approvals.IRepository) SignatureRepository
NewRepository creates a new instance of the signature repository service
type SignatureService ¶
type SignatureService interface { GetSignature(ctx context.Context, signatureID string) (*models.Signature, error) GetIndividualSignature(ctx context.Context, claGroupID, userID string, approved, signed *bool) (*models.Signature, error) GetIndividualSignatures(ctx context.Context, claGroupID, userID string, approved, signed *bool) ([]*models.Signature, error) GetCorporateSignature(ctx context.Context, claGroupID, companyID string, approved, signed *bool) (*models.Signature, error) GetCorporateSignatures(ctx context.Context, claGroupID, companyID string, approved, signed *bool) ([]*models.Signature, error) GetProjectSignatures(ctx context.Context, params signatures.GetProjectSignaturesParams) (*models.Signatures, error) GetCCLASignatures(ctx context.Context, signed, approved *bool) ([]*ItemSignature, error) CreateProjectSummaryReport(ctx context.Context, params signatures.CreateProjectSummaryReportParams) (*models.SignatureReport, error) GetProjectCompanySignature(ctx context.Context, companyID, projectID string, approved, signed *bool, nextKey *string, pageSize *int64) (*models.Signature, error) GetProjectCompanySignatures(ctx context.Context, params signatures.GetProjectCompanySignaturesParams) (*models.Signatures, error) GetProjectCompanyEmployeeSignatures(ctx context.Context, params signatures.GetProjectCompanyEmployeeSignaturesParams, criteria *ApprovalCriteria) (*models.Signatures, error) GetCompanySignatures(ctx context.Context, params signatures.GetCompanySignaturesParams) (*models.Signatures, error) GetCompanyIDsWithSignedCorporateSignatures(ctx context.Context, claGroupID string) ([]SignatureCompanyID, error) GetUserSignatures(ctx context.Context, params signatures.GetUserSignaturesParams, projectID *string) (*models.Signatures, error) InvalidateProjectRecords(ctx context.Context, projectID, note string) (int, error) CreateSignature(ctx context.Context, signature *ItemSignature) error UpdateSignature(ctx context.Context, signatureID string, updates map[string]interface{}) error SaveOrUpdateSignature(ctx context.Context, signature *ItemSignature) error HasUserSigned(ctx context.Context, user *models.User, projectID string) (*bool, *bool, error) GetGithubOrganizationsFromApprovalList(ctx context.Context, signatureID string, githubAccessToken string) ([]models.GithubOrg, error) AddGithubOrganizationToApprovalList(ctx context.Context, signatureID string, approvalListParams models.GhOrgWhitelist, githubAccessToken string) ([]models.GithubOrg, error) DeleteGithubOrganizationFromApprovalList(ctx context.Context, signatureID string, approvalListParams models.GhOrgWhitelist, githubAccessToken string) ([]models.GithubOrg, error) UpdateApprovalList(ctx context.Context, authUser *auth.User, claGroupModel *models.ClaGroup, companyModel *models.Company, claGroupID string, params *models.ApprovalList, projectSFID string) (*models.Signature, error) AddCLAManager(ctx context.Context, signatureID, claManagerID string) (*models.Signature, error) RemoveCLAManager(ctx context.Context, ignatureID, claManagerID string) (*models.Signature, error) GetClaGroupICLASignatures(ctx context.Context, claGroupID string, searchTerm *string, approved, signed *bool, pageSize int64, nextKey string, withExtraDetails bool) (*models.IclaSignatures, error) GetClaGroupCCLASignatures(ctx context.Context, claGroupID string, approved, signed *bool) (*models.Signatures, error) GetClaGroupCorporateContributors(ctx context.Context, claGroupID string, companyID *string, pageSize *int64, nextKey *string, searchTerm *string) (*models.CorporateContributorList, error) // createOrGetEmployeeModels(ctx context.Context, claGroupModel *models.ClaGroup, companyModel *models.Company, corporateSignatureModel *models.Signature) ([]*models.User, error) CreateOrUpdateEmployeeSignature(ctx context.Context, claGroupModel *models.ClaGroup, companyModel *models.Company, corporateSignatureModel *models.Signature) ([]*models.User, error) UpdateEnvelopeDetails(ctx context.Context, signatureID, envelopeID string, signURL *string) (*models.Signature, error) // handleGitHubStatusUpdate(ctx context.Context, employeeUserModel *models.User) error ProcessEmployeeSignature(ctx context.Context, companyModel *models.Company, claGroupModel *models.ClaGroup, user *models.User) (*bool, error) UserIsApproved(ctx context.Context, user *models.User, cclaSignature *models.Signature) (bool, error) }
SignatureService interface
func NewService ¶
func NewService(repo SignatureRepository, companyService company.IService, usersService users.Service, eventsService events.Service, githubOrgValidation bool, repositoryService repositories.Service, githubOrgService github_organizations.ServiceInterface, claGroupService service2.Service, gitLabApp *gitlab_api.App, CLABaseAPIURL, CLALandingPage, CLALogoURL string) SignatureService
NewService creates a new signature service