MCPcopy Create free account
hub / github.com/bytebase/bytebase / GetMaskingRulePolicy

Method GetMaskingRulePolicy

backend/store/policy.go:357–378  ·  view source on GitHub ↗

GetMaskingRulePolicy will get the masking rule policy.

(ctx context.Context, workspaceID string)

Source from the content-addressed store, hash-verified

355
356// GetMaskingRulePolicy will get the masking rule policy.
357func (s *Store) GetMaskingRulePolicy(ctx context.Context, workspaceID string) (*storepb.MaskingRulePolicy, error) {
358 policy, err := s.GetPolicy(ctx, &FindPolicyMessage{
359 Workspace: workspaceID,
360 ResourceType: new(storepb.Policy_WORKSPACE),
361 Resource: new(common.FormatWorkspace(workspaceID)),
362 Type: new(storepb.Policy_MASKING_RULE),
363 })
364 if err != nil {
365 return nil, err
366 }
367
368 if policy == nil {
369 return &storepb.MaskingRulePolicy{}, nil
370 }
371
372 p := new(storepb.MaskingRulePolicy)
373 if err := common.ProtojsonUnmarshaler.Unmarshal([]byte(policy.Payload), p); err != nil {
374 return nil, err
375 }
376
377 return p, nil
378}
379
380// GetMaskingExemptionPolicyByProject gets the masking exemption policy for a project.
381func (s *Store) GetMaskingExemptionPolicyByProject(ctx context.Context, workspaceID string, projectID string) (*storepb.MaskingExemptionPolicy, error) {

Callers 3

MaskResultsMethod · 0.45

Calls 2

GetPolicyMethod · 0.95
UnmarshalMethod · 0.80

Tested by

no test coverage detected