Skip to content

Commit

Permalink
Option now is AVAILABLE_PROJECTS_QUERY
Browse files Browse the repository at this point in the history
  • Loading branch information
abdolence committed Nov 29, 2023
1 parent 09df8b1 commit 7ef4aa5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public Options getOptions() {
public Set<ProjectId> listAvailableProjects(
UserId user
) throws AccessException, IOException {
if(this.options.searchAllAvailableProjects == null) {
if(this.options.availableProjectsQuery == null) {
//
// NB. To reliably find projects, we have to let the Asset API consider
// inherited role bindings by using the "expand resources" flag. This
Expand Down Expand Up @@ -153,8 +153,8 @@ public Set<ProjectId> listAvailableProjects(
.collect(Collectors.toSet());
}
else {
// Used as alternative option if searchAllAvailableProjects is set and the main approach with Asset API is not working fast enough.
return new HashSet<>(resourceManagerAdapter.searchProjectIds(this.options.searchAllAvailableProjects));
// Used as alternative option if availableProjectsQuery is set and the main approach with Asset API is not working fast enough.
return new HashSet<>(resourceManagerAdapter.searchProjectIds(this.options.availableProjectsQuery));
}
}

Expand Down Expand Up @@ -374,14 +374,14 @@ public static class Options {
* - parent:organizations/{organization_id}
* (https://cloud.google.com/resource-manager/reference/rest/v3/projects/search#query-parameters)
*/
public final String searchAllAvailableProjects;
public final String availableProjectsQuery;

/**
* Search inherited IAM policies
*/
public Options(String scope, String searchAllAvailableProjects) {
public Options(String scope, String availableProjectsQuery) {
this.scope = scope;
this.searchAllAvailableProjects = searchAllAvailableProjects;
this.availableProjectsQuery = availableProjectsQuery;
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ public RuntimeConfiguration(Function<String, String> readSetting) {
this.maxNumberOfJitRolesPerSelfApproval = new IntSetting(
List.of("ACTIVATION_REQUEST_MAX_ROLES"),
10);
this.searchAllAvailableProjects = new StringSetting(
List.of("SEARCH_ALL_AVAILABLE_PROJECTS"),
this.availableProjectsQuery = new StringSetting(
List.of("AVAILABLE_PROJECTS_QUERY"),
null);

//
Expand Down Expand Up @@ -207,7 +207,7 @@ public RuntimeConfiguration(Function<String, String> readSetting) {
* - parent:folders/{folder_id}
* - parent:organizations/{organization_id}
*/
public final StringSetting searchAllAvailableProjects;
public final StringSetting availableProjectsQuery;

public boolean isSmtpConfigured() {
var requiredSettings = List.of(smtpHost, smtpPort, smtpSenderName, smtpSenderAddress);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,8 @@ public GoogleCredentials getApplicationCredentials() {
public RoleDiscoveryService.Options getRoleDiscoveryServiceOptions() {
return new RoleDiscoveryService.Options(
this.configuration.scope.getValue(),
this.configuration.searchAllAvailableProjects.isValid() ?
this.configuration.searchAllAvailableProjects.getValue() : null
this.configuration.availableProjectsQuery.isValid() ?
this.configuration.availableProjectsQuery.getValue() : null
);
}

Expand Down

0 comments on commit 7ef4aa5

Please sign in to comment.