GetMaskingRulePolicy will get the masking rule policy.
(ctx context.Context, workspaceID string)
| 355 | |
| 356 | // GetMaskingRulePolicy will get the masking rule policy. |
| 357 | func (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. |
| 381 | func (s *Store) GetMaskingExemptionPolicyByProject(ctx context.Context, workspaceID string, projectID string) (*storepb.MaskingExemptionPolicy, error) { |
no test coverage detected