Documentation
¶
Overview ¶
Package account is api's AccountService of the contract novatrail.api.v1: the account and its invite code, and, task by task, its PIN, profiles and deletion (R04, R34, R35, R36). Its methods run after the checks of architecture 3.1, which give them the caller (rpc.CallerFrom); a method it has no handler for yet answers unimplemented.
Index ¶
- type Option
- type Rights
- type Service
- func (s *Service) ChangePin(ctx context.Context, req *v1.ChangePinRequest) (*v1.ChangePinResponse, error)
- func (s *Service) CreateAccount(ctx context.Context, req *v1.CreateAccountRequest) (*v1.CreateAccountResponse, error)
- func (s *Service) CreateChildProfile(ctx context.Context, req *v1.CreateChildProfileRequest) (*v1.CreateChildProfileResponse, error)
- func (s *Service) CreateOwnerProfile(ctx context.Context, req *v1.CreateOwnerProfileRequest) (*v1.CreateOwnerProfileResponse, error)
- func (s *Service) DeleteAccount(ctx context.Context, _ *v1.DeleteAccountRequest) (*v1.DeleteAccountResponse, error)
- func (s *Service) DeleteProfile(ctx context.Context, req *v1.DeleteProfileRequest) (*v1.DeleteProfileResponse, error)
- func (s *Service) GetAccount(ctx context.Context, _ *v1.GetAccountRequest) (*v1.GetAccountResponse, error)
- func (s *Service) RequestChildConsent(ctx context.Context, req *v1.RequestChildConsentRequest) (*v1.RequestChildConsentResponse, error)
- func (s *Service) ResetPin(ctx context.Context, req *v1.ResetPinRequest) (*v1.ResetPinResponse, error)
- func (s *Service) SetPin(ctx context.Context, req *v1.SetPinRequest) (*v1.SetPinResponse, error)
- func (s *Service) SetVoicing(ctx context.Context, req *v1.SetVoicingRequest) (*v1.SetVoicingResponse, error)
- func (s *Service) UpdateProfile(ctx context.Context, req *v1.UpdateProfileRequest) (*v1.UpdateProfileResponse, error)
- func (s *Service) VerifyPin(ctx context.Context, req *v1.VerifyPinRequest) (*v1.VerifyPinResponse, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶ added in v0.1.6
type Option func(*Service)
Option is a choice of New's that a test makes.
type Rights ¶ added in v0.1.8
type Rights interface {
WriteOwner(ctx context.Context, accountID, profileID string) error
deletion.Rights
}
Rights is what writes the tuple of a profile it makes, and deletes the tuples of what it deletes: authz.Rights.
type Service ¶
type Service struct {
apiv1connect.UnimplementedAccountServiceHandler
// contains filtered or unexported fields
}
Service is the AccountService on the database api.
func New ¶
New is the AccountService on db, with the tuples of the profiles in rights and the users at signin.
func (*Service) ChangePin ¶ added in v0.1.6
func (s *Service) ChangePin(ctx context.Context, req *v1.ChangePinRequest) (*v1.ChangePinResponse, error)
ChangePin changes the PIN by the PIN before it, which counts as VerifyPin counts it; a wrong one changes nothing.
func (*Service) CreateAccount ¶
func (s *Service) CreateAccount(ctx context.Context, req *v1.CreateAccountRequest) (*v1.CreateAccountResponse, error)
CreateAccount creates the caller's account by an invite code and the owner's statement that they are 18 or older. A caller with an account already gets CAUSE_ALREADY_EXISTS before the statement and the code are looked at, so that a repeat after a lost answer gets that rather than a code redeemed (contract, CreateAccount).
func (*Service) CreateChildProfile ¶ added in v0.1.7
func (s *Service) CreateChildProfile(ctx context.Context, req *v1.CreateChildProfileRequest) (*v1.CreateChildProfileResponse, error)
CreateChildProfile creates a child's profile by its consent, once it is confirmed, of its category and country, and its tuple before the COMMIT. A consent with its profile already is CAUSE_ALREADY_EXISTS before its state is looked at, so that a repeat is told the profile is there.
func (*Service) CreateOwnerProfile ¶ added in v0.1.7
func (s *Service) CreateOwnerProfile(ctx context.Context, req *v1.CreateOwnerProfileRequest) (*v1.CreateOwnerProfileResponse, error)
CreateOwnerProfile creates the owner's profile, of the category adult by the owner's statement, with its consent, and its tuple before the COMMIT (R04, R36; architecture 3.1). A profile of the owner there already comes before the country, so that a repeat is told it is there.
func (*Service) DeleteAccount ¶ added in v0.1.8
func (s *Service) DeleteAccount(ctx context.Context, _ *v1.DeleteAccountRequest) (*v1.DeleteAccountResponse, error)
DeleteAccount deletes the account, all of it and its user at the sign-in service, by a fresh sign-in, which the checks held (R20, R21). Once its data is gone from the database the answer is "deleted", and what does not finish the daily job does; a repeat gets "the account is gone" from the checks.
func (*Service) DeleteProfile ¶ added in v0.1.8
func (s *Service) DeleteProfile(ctx context.Context, req *v1.DeleteProfileRequest) (*v1.DeleteProfileResponse, error)
DeleteProfile deletes the profile and all of it, by can_manage and a fresh sign-in, which the checks held (R20, R21). The owner's profile goes the same way, and the last profile leaves the account without profiles. A tuple left after the database is done is still "deleted": its line names the failure, and the profile's row is gone, so the tuple gives a right to nothing; its repeat deletes it (architecture 3.10).
func (*Service) GetAccount ¶
func (s *Service) GetAccount(ctx context.Context, _ *v1.GetAccountRequest) (*v1.GetAccountResponse, error)
GetAccount gives the account of the caller: whether its PIN is set, its profiles and its consents for a child with no profile. Open attempts and lesson runs come with epic E3, which keeps them.
func (*Service) RequestChildConsent ¶ added in v0.1.7
func (s *Service) RequestChildConsent(ctx context.Context, req *v1.RequestChildConsentRequest) (*v1.RequestChildConsentResponse, error)
RequestChildConsent records a consent for a child that waits, with the category worked out of the age and the country; the age in years lives in this request's memory alone (privacy 3.3 spec). A repeat under its key is the same consent, and the key's fingerprint is slow, as the request carries the age.
func (*Service) ResetPin ¶ added in v0.1.6
func (s *Service) ResetPin(ctx context.Context, req *v1.ResetPinRequest) (*v1.ResetPinResponse, error)
ResetPin changes a forgotten PIN by a fresh sign-in, which the checks have held last (R20): it sets the new PIN whether there was one or not, and opens the input.
func (*Service) SetPin ¶ added in v0.1.6
func (s *Service) SetPin(ctx context.Context, req *v1.SetPinRequest) (*v1.SetPinResponse, error)
SetPin sets the PIN of the section for adults, while the account has none.
func (*Service) SetVoicing ¶ added in v0.1.7
func (s *Service) SetVoicing(ctx context.Context, req *v1.SetVoicingRequest) (*v1.SetVoicingResponse, error)
SetVoicing sets the voicing alone, from the screen of a task: the checks have held the right can_learn, which the learner has as well as the adult.
func (*Service) UpdateProfile ¶ added in v0.1.7
func (s *Service) UpdateProfile(ctx context.Context, req *v1.UpdateProfileRequest) (*v1.UpdateProfileResponse, error)
UpdateProfile changes the settings sent, and leaves the others (contract, ProfileSettings). The checks have held the right can_manage.
func (*Service) VerifyPin ¶ added in v0.1.6
func (s *Service) VerifyPin(ctx context.Context, req *v1.VerifyPinRequest) (*v1.VerifyPinResponse, error)
VerifyPin checks a PIN: a wrong one counts toward closing the input.