replace static status definition by const
This commit is contained in:
@@ -31,9 +31,11 @@ func (s *Service) CreatePrincipal(ctx context.Context, params CreatePrincipalPar
|
||||
|
||||
status := params.Status
|
||||
if status == "" {
|
||||
status = "active"
|
||||
status = StatusActive
|
||||
}
|
||||
if status != "active" && status != "disabled" && status != "revoked" {
|
||||
switch status {
|
||||
case StatusActive, StatusDisabled, StatusRevoked:
|
||||
default:
|
||||
return nil, fmt.Errorf("%w: %q", ErrInvalidStatus, status)
|
||||
}
|
||||
|
||||
@@ -87,7 +89,7 @@ func (s *Service) CreateGuest(ctx context.Context, name string) (*Principal, err
|
||||
ID: id,
|
||||
Kind: KindGuest,
|
||||
Name: name,
|
||||
Status: "active",
|
||||
Status: StatusActive,
|
||||
CreatedAt: now,
|
||||
}); err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user