Skip to content

Commit

Permalink
feat: grant dormancy check
Browse files Browse the repository at this point in the history
  • Loading branch information
rahmatrhd committed Jul 26, 2023
1 parent e206ed2 commit 7fbb898
Show file tree
Hide file tree
Showing 33 changed files with 1,361 additions and 237 deletions.
2 changes: 1 addition & 1 deletion api/handler/v1beta1/activity.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func (s *GRPCServer) ListActivities(ctx context.Context, req *guardianv1beta1.Li
}

func (s *GRPCServer) ImportActivities(ctx context.Context, req *guardianv1beta1.ImportActivitiesRequest) (*guardianv1beta1.ImportActivitiesResponse, error) {
filter := domain.ImportActivitiesFilter{
filter := domain.ListActivitiesFilter{
ProviderID: req.GetProviderId(),
ResourceIDs: req.GetResourceIds(),
AccountIDs: req.GetAccountIds(),
Expand Down
2 changes: 1 addition & 1 deletion api/handler/v1beta1/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ type resourceService interface {
type activityService interface {
GetOne(context.Context, string) (*domain.Activity, error)
Find(context.Context, domain.ListProviderActivitiesFilter) ([]*domain.Activity, error)
Import(context.Context, domain.ImportActivitiesFilter) ([]*domain.Activity, error)
Import(context.Context, domain.ListActivitiesFilter) ([]*domain.Activity, error)
}

//go:generate mockery --name=providerService --exported --with-expecter
Expand Down
10 changes: 5 additions & 5 deletions api/handler/v1beta1/mocks/activityService.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions api/handler/v1beta1/mocks/providerActivityService.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions cli/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,15 @@ func runJobCmd() *cobra.Command {
$ guardian job run expiring_grant_notification
$ guardian job run revoke_expired_grants
$ guardian job run revoke_grants_by_user_criteria
$ guardian job run grant_dormancy_check
`),
Args: cobra.ExactValidArgs(1),
ValidArgs: []string{
string(jobs.TypeFetchResources),
string(jobs.TypeExpiringGrantNotification),
string(jobs.TypeRevokeExpiredGrants),
string(jobs.TypeRevokeGrantsByUserCriteria),
string(jobs.TypeGrantDormancyCheck),

string(jobs.TypeRevokeExpiredAccess),
string(jobs.TypeExpiringAccessNotification),
Expand Down Expand Up @@ -112,6 +114,10 @@ func runJobCmd() *cobra.Command {
handler: handler.RevokeGrantsByUserCriteria,
config: config.Jobs.RevokeGrantsByUserCriteria.Config,
},
jobs.TypeGrantDormancyCheck: {
handler: handler.GrantDormancyCheck,
config: config.Jobs.GrantDormancyCheck.Config,
},

// deprecated job names
jobs.TypeExpiringAccessNotification: {
Expand Down
10 changes: 5 additions & 5 deletions core/activity/mocks/providerService.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions core/activity/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type repository interface {

//go:generate mockery --name=providerService --exported --with-expecter
type providerService interface {
ImportActivities(context.Context, domain.ImportActivitiesFilter) ([]*domain.Activity, error)
ImportActivities(context.Context, domain.ListActivitiesFilter) ([]*domain.Activity, error)
}

//go:generate mockery --name=auditLogger --exported --with-expecter
Expand Down Expand Up @@ -61,7 +61,7 @@ func (s *Service) Find(ctx context.Context, filter domain.ListProviderActivities
return s.repo.Find(ctx, filter)
}

func (s *Service) Import(ctx context.Context, filter domain.ImportActivitiesFilter) ([]*domain.Activity, error) {
func (s *Service) Import(ctx context.Context, filter domain.ListActivitiesFilter) ([]*domain.Activity, error) {
activities, err := s.providerService.ImportActivities(ctx, filter)
if err != nil {
return nil, err
Expand Down
157 changes: 147 additions & 10 deletions core/grant/mocks/providerService.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 7fbb898

Please sign in to comment.