Skip to content

Commit 61a9b23

Browse files
tkAcharya007Harness
authored andcommitted
feat: [SSCA-4077]: Onboard STO Exemptions Workflow (#71)
* feat: [SSCA-4077]: Added more description * feat: [SSCA-4077]: Rebased to master * feat: [SSCA-4077]: Add userId and approverID * feat: [SSCA-4077]: refactored event * feat: [SSCA-4077]: rebased to master * feat: [SSCA-4077]: move frontend to sto * feat: [SSCA-4077]: rebased to sampling changes * feat: [SSCA-4077]: Adding pat token to gloable exemptions listing * feat: add OpenAPI spec and codegen tasks for Security Test Orchestration * feat: [SSCA-4077]: Onboard STO Exemptions Workflow * feat: [SSCA-4077]: Onboard STO Exemptions Workflow * Common schema for both event and prompts * minor updates * more refactoring on events * removed dummy code * Added changes for sampling
1 parent 98b4efb commit 61a9b23

File tree

7 files changed

+1954
-153
lines changed

7 files changed

+1954
-153
lines changed

client/accesscontrol.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const (
1616
listRoleAssignmentsPath = "/api/roleassignments/filter"
1717
getUserGroupPath = "/v2/user-groups"
1818
getServiceAccountPath = "/serviceaccount/aggregate"
19+
getCurrentUserPath = "/user/currentUser"
1920
)
2021

2122
type RBACService struct {
@@ -208,3 +209,19 @@ func (sAccount *PrincipalService) GetServiceAccount(ctx context.Context, scope d
208209

209210
return resp, nil
210211
}
212+
213+
func (currentUserInfo *PrincipalService) GetCurrentUser(ctx context.Context, scope dto.Scope) (*dto.AccessControlOutput[dto.CurrentUserData], error) {
214+
215+
params := make(map[string]string)
216+
path := fmt.Sprintf(getCurrentUserPath)
217+
218+
addScope(scope, params)
219+
220+
resp := &dto.AccessControlOutput[dto.CurrentUserData]{}
221+
err := currentUserInfo.Client.Get(ctx, path, params, map[string]string{}, resp)
222+
if err != nil {
223+
return nil, fmt.Errorf("Failed to list the user info: %w", err)
224+
}
225+
226+
return resp, nil
227+
}

client/dto/accessControl.go

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,3 +210,54 @@ type ResourceGroup struct {
210210
Color string `json:"color,omitempty"`
211211
Description string `json:"description,omitempty"`
212212
}
213+
214+
type CurrentUserData struct {
215+
UUID string `json:"uuid,omitempty"`
216+
Name string `json:"name,omitempty"`
217+
Email string `json:"email,omitempty"`
218+
Token interface{} `json:"token,omitempty"`
219+
DefaultAccountId string `json:"defaultAccountId,omitempty"`
220+
Intent interface{} `json:"intent,omitempty"`
221+
Accounts []AccountInfo `json:"accounts,omitempty"`
222+
Admin bool `json:"admin,omitempty"`
223+
TwoFactorAuthenticationEnabled bool `json:"twoFactorAuthenticationEnabled,omitempty"`
224+
EmailVerified bool `json:"emailVerified,omitempty"`
225+
Locked bool `json:"locked,omitempty"`
226+
Disabled bool `json:"disabled,omitempty"`
227+
SignupAction interface{} `json:"signupAction,omitempty"`
228+
Edition interface{} `json:"edition,omitempty"`
229+
BillingFrequency interface{} `json:"billingFrequency,omitempty"`
230+
UTMInfo UTMInfo `json:"utmInfo,omitempty"`
231+
ExternallyManaged bool `json:"externallyManaged,omitempty"`
232+
GivenName interface{} `json:"givenName,omitempty"`
233+
FamilyName interface{} `json:"familyName,omitempty"`
234+
ExternalId interface{} `json:"externalId,omitempty"`
235+
CreatedAt int64 `json:"createdAt,omitempty"`
236+
LastUpdatedAt int64 `json:"lastUpdatedAt,omitempty"`
237+
UserPreferences UserPreferences `json:"userPreferences,omitempty"`
238+
IsEnrichedInfoCollected bool `json:"isEnrichedInfoCollected,omitempty"`
239+
LastLogin int64 `json:"lastLogin,omitempty"`
240+
}
241+
242+
type AccountInfo struct {
243+
UUID string `json:"uuid,omitempty"`
244+
AccountName string `json:"accountName,omitempty"`
245+
CompanyName string `json:"companyName,omitempty"`
246+
DefaultExperience string `json:"defaultExperience,omitempty"`
247+
CreatedFromNG bool `json:"createdFromNG,omitempty"`
248+
NextGenEnabled bool `json:"nextGenEnabled,omitempty"`
249+
}
250+
251+
type UTMInfo struct {
252+
UTMSource interface{} `json:"utmSource,omitempty"`
253+
UTMContent interface{} `json:"utmContent,omitempty"`
254+
UTMMedium interface{} `json:"utmMedium,omitempty"`
255+
UTMTerm interface{} `json:"utmTerm,omitempty"`
256+
UTMCampaign interface{} `json:"utmCampaign,omitempty"`
257+
}
258+
259+
type UserPreferences struct {
260+
RecentSelectedScopes string `json:"recent_selected_scopes,omitempty"`
261+
EnableNewNav string `json:"enable_new_nav,omitempty"`
262+
LandingPageURL interface{} `json:"landing_page_url,omitempty"`
263+
}

0 commit comments

Comments
 (0)