Skip to content

Commit

Permalink
πŸš› : rename Team to Organization
Browse files Browse the repository at this point in the history
  • Loading branch information
juwit committed Jul 1, 2022
1 parent 57e49d3 commit e9fb489
Show file tree
Hide file tree
Showing 87 changed files with 417 additions and 424 deletions.
8 changes: 4 additions & 4 deletions src/main/client/app/pages/dashboard/dashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
</div>
</div>
<div
v-if="isWithoutTeam"
v-if="isWithoutOrganization"
class="center"
>
<div class="error_page">
Expand All @@ -49,7 +49,7 @@
</div>
<br>
<h3>Hi there !</h3>
<p>It seems that you're not a member of a team yet. Ask your admin to add you a team !</p>
<p>It seems that you're not a member of a organization yet. Ask your admin to add you a organization !</p>
<p>Until then, you'll only be able to use public modules.</p>
</div>
</div>
Expand All @@ -72,8 +72,8 @@
}),
computed: {
...mapState('session', ['user']),
isWithoutTeam() {
return !this.user.admin && !this.user.team;
isWithoutOrganization() {
return !this.user.admin && !this.user.organization;
},
},
async created() {
Expand Down
14 changes: 7 additions & 7 deletions src/main/client/app/pages/modules/module.vue
Original file line number Diff line number Diff line change
Expand Up @@ -97,19 +97,19 @@

<hr>

<h2>Authorized Teams</h2>
<h2>Authorized Organizations</h2>

<b-form-row>
<b-col cols="6">
<b-form-group>
<vue-multiselect
v-model="module.authorizedTeams"
v-model="module.authorizedOrganizations"
:multiple="true"
label="id"
track-by="id"
searchable
placeholder="Select teams"
:options="teams"
placeholder="Select organizations"
:options="organizations"
/>
</b-form-group>
</b-col>
Expand Down Expand Up @@ -164,7 +164,7 @@
refreshModule,
updateModule,
} from '@/shared/api/modules-api';
import { getTeams } from '@/shared/api/teams-api';
import { getOrganizations } from '@/shared/api/organizations-api';
import {
displayConfirmDialog,
displayNotification,
Expand All @@ -190,7 +190,7 @@
module: null,
isTerraformImageValid: null,
isTerraformImageOverride: null,
teams: [],
organizations: [],
providers: [
{ value: 'aws', text: 'AWS' },
{ value: 'azurerm', text: 'Azure' },
Expand All @@ -210,7 +210,7 @@
async created() {
this.module = await getModule(this.moduleId);
this.teams = await getTeams();
this.organizations = await getOrganizations();
},
methods: {
Expand Down
8 changes: 4 additions & 4 deletions src/main/client/app/pages/users/organizations.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

<div class="block mt-3">
<b-table
:items="teams"
:items="organizations"
:fields="fields"
striped
fixed
Expand All @@ -52,13 +52,13 @@
</template>

<script>
import { createOrganization, deleteOrganization, getTeams } from '@/shared/api/teams-api';
import { createOrganization, deleteOrganization, getOrganizations } from '@/shared/api/organizations-api';
import { displayNotification } from '@/shared/services/modal-service';
export default {
name: 'AppOrganizations',
data: () => ({
teams: [],
organizations: [],
newOrganizationName: '',
fields: [
{ key: 'id', label: 'Name', sortable: true },
Expand All @@ -70,7 +70,7 @@
},
methods: {
async refresh() {
this.teams = await getTeams();
this.organizations = await getOrganizations();
},
async createOrg() {
await createOrganization({ id: this.newOrganizationName })
Expand Down
16 changes: 8 additions & 8 deletions src/main/client/app/pages/users/user-edit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@
</b-form-group>

<b-form-group
label="Team"
description="The user team"
label="Organization"
description="The user organization"
>
<vue-multiselect
v-model="user.team"
:options="teams"
v-model="user.organization"
:options="organizations"
track-by="id"
label="id"
:multiple="false"
placeholder="Select user team"
placeholder="Select user organization"
:show-labels="false"
/>
</b-form-group>
Expand Down Expand Up @@ -131,7 +131,7 @@
</template>

<script>
import { getTeams } from '@/shared/api/teams-api';
import { getOrganizations } from '@/shared/api/organizations-api';
import { changeUserPassword, deleteUser, updateUser } from '@/shared/api/users-api';
import { displayNotification } from '@/shared/services/modal-service';
Expand All @@ -150,10 +150,10 @@
},
},
data: () => ({
teams: [],
organizations: [],
}),
async created() {
this.teams = await getTeams();
this.organizations = await getOrganizations();
},
methods: {
async redirectToUsersPage() {
Expand Down
16 changes: 8 additions & 8 deletions src/main/client/app/pages/users/user-new.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,16 @@
</b-form-group>

<b-form-group
label="Team"
description="The user team"
label="Organization"
description="The user organization"
>
<vue-multiselect
v-model="user.team"
:options="teams"
v-model="user.organization"
:options="organizations"
track-by="id"
label="id"
:multiple="false"
placeholder="Select user team"
placeholder="Select user organization"
:show-labels="false"
/>
</b-form-group>
Expand Down Expand Up @@ -79,18 +79,18 @@
</template>

<script>
import { getTeams } from '@/shared/api/teams-api';
import { getOrganizations } from '@/shared/api/organizations-api';
import { createUser } from '@/shared/api/users-api';
import { displayNotification } from '@/shared/services/modal-service';
export default {
name: 'AppUserEdition',
data: () => ({
teams: [],
organizations: [],
user: {},
}),
async created() {
this.teams = await getTeams();
this.organizations = await getOrganizations();
},
methods: {
async createUser() {
Expand Down
8 changes: 4 additions & 4 deletions src/main/client/app/pages/users/users.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,24 +47,24 @@
getUsers,
updateUser,
} from '@/shared/api/users-api';
import { getTeams } from '@/shared/api/teams-api';
import { getOrganizations } from '@/shared/api/organizations-api';
import { displayNotification } from '@/shared/services/modal-service';
import AppUserName from '@/pages/users/user-name.vue';
export default {
name: 'AppUsers',
components: { AppUserName },
data: () => ({
teams: [],
organizations: [],
users: [],
fields: [
{ key: 'username', label: 'User', sortable: true },
{ key: 'team.id', label: 'Team', sortable: true },
{ key: 'organization.id', label: 'Organization', sortable: true },
{ key: 'edit' },
],
}),
async created() {
[this.users, this.teams] = await Promise.all([getUsers(), getTeams()]);
[this.users, this.organizations] = await Promise.all([getUsers(), getOrganizations()]);
},
methods: {
saveUser(user) {
Expand Down
7 changes: 7 additions & 0 deletions src/main/client/app/shared/api/organizations-api.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import axios from 'axios';

export const getOrganizations = async () => axios.get('/api/organizations');

export const deleteOrganization = async (organizationId) => axios.delete(`/api/organizations/${organizationId}`);

export const createOrganization = async (organization) => axios.post('/api/organizations', organization);
7 changes: 0 additions & 7 deletions src/main/client/app/shared/api/teams-api.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.gaia_app.client.controller

import io.gaia_app.teams.User
import io.gaia_app.organizations.User
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.autoconfigure.security.oauth2.client.OAuth2ClientProperties
import org.springframework.security.core.Authentication
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.gaia_app.config

import io.gaia_app.teams.User
import io.gaia_app.teams.repository.UserRepository
import io.gaia_app.organizations.User
import io.gaia_app.organizations.repository.UserRepository
import org.springframework.data.domain.AuditorAware
import org.springframework.security.core.context.SecurityContextHolder
import org.springframework.stereotype.Component
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package io.gaia_app.config.security

import com.fasterxml.jackson.databind.ObjectMapper
import io.gaia_app.teams.User
import io.gaia_app.teams.repository.UserRepository
import io.gaia_app.organizations.User
import io.gaia_app.organizations.repository.UserRepository
import org.springframework.http.MediaType
import org.springframework.security.access.AccessDeniedException
import org.springframework.security.core.Authentication
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/io/gaia_app/config/security/SecurityConfig.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.gaia_app.config.security

import io.gaia_app.teams.repository.UserRepository
import io.gaia_app.organizations.repository.UserRepository
import org.springframework.beans.factory.annotation.Value
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
Expand Down Expand Up @@ -90,7 +90,7 @@ class SecurityConfig(

}

fun io.gaia_app.teams.User.toAuthorities(): List<GrantedAuthority> {
fun io.gaia_app.organizations.User.toAuthorities(): List<GrantedAuthority> {
return if (this.isAdmin) {
listOf(SimpleGrantedAuthority("ROLE_ADMIN"), SimpleGrantedAuthority("ROLE_USER"))
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package io.gaia_app.config.security.oauth2

import io.gaia_app.config.security.SuccessHandler
import io.gaia_app.registries.RegistryOAuth2Provider
import io.gaia_app.teams.OAuth2User
import io.gaia_app.teams.User
import io.gaia_app.teams.repository.UserRepository
import io.gaia_app.organizations.OAuth2User
import io.gaia_app.organizations.User
import io.gaia_app.organizations.repository.UserRepository
import org.springframework.boot.autoconfigure.security.oauth2.client.ClientsConfiguredCondition
import org.springframework.context.annotation.Conditional
import org.springframework.security.core.Authentication
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/io/gaia_app/credentials/Credentials.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import com.fasterxml.jackson.annotation.JsonSubTypes.Type
import com.fasterxml.jackson.annotation.JsonTypeInfo
import com.fasterxml.jackson.annotation.JsonTypeInfo.As.PROPERTY
import com.fasterxml.jackson.annotation.JsonTypeInfo.Id.NAME
import io.gaia_app.teams.User
import io.gaia_app.organizations.User
import org.springframework.data.annotation.CreatedBy
import org.springframework.data.annotation.Id
import org.springframework.data.mongodb.core.mapping.DBRef
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.gaia_app.credentials

import io.gaia_app.teams.User
import io.gaia_app.organizations.User
import org.springframework.data.mongodb.repository.MongoRepository
import java.util.*

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.gaia_app.credentials;

import io.gaia_app.teams.User;
import io.gaia_app.organizations.User;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus;
import org.springframework.security.access.annotation.Secured;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.gaia_app.credentials

import io.gaia_app.encryption.EncryptionService
import io.gaia_app.teams.User
import io.gaia_app.organizations.User
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
import org.springframework.stereotype.Service
import java.util.*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package io.gaia_app.dashboard.controller
import io.gaia_app.modules.repository.TerraformModuleRepository
import io.gaia_app.stacks.bo.StackState
import io.gaia_app.stacks.repository.StackRepository
import io.gaia_app.teams.Team
import io.gaia_app.teams.User
import io.gaia_app.organizations.Organization
import io.gaia_app.organizations.User
import org.springframework.security.access.annotation.Secured
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.RequestMapping
Expand All @@ -18,19 +18,19 @@ class DashboardRestController(
private val stackRepository: StackRepository) {

@GetMapping("/summary")
fun summary(user: User, team: Team?) =
fun summary(user: User, organization: Organization?) =
when {
user.isAdmin -> {
mapOf(
"modulesCount" to moduleRepository.count(),
"runningStacksCount" to stackRepository.countStacksByState(StackState.RUNNING),
"toUpdateStacksCount" to stackRepository.countStacksByState(StackState.TO_UPDATE))
}
team != null -> {
organization != null -> {
mapOf(
"modulesCount" to moduleRepository.countByAuthorizedTeamsContainingOrModuleMetadataCreatedBy(team, user),
"runningStacksCount" to stackRepository.countStacksByStateAndOwnerTeam(StackState.RUNNING, team),
"toUpdateStacksCount" to stackRepository.countStacksByStateAndOwnerTeam(StackState.TO_UPDATE, team))
"modulesCount" to moduleRepository.countByAuthorizedOrganizationsContainingOrModuleMetadataCreatedBy(organization, user),
"runningStacksCount" to stackRepository.countStacksByStateAndOwnerOrganization(StackState.RUNNING, organization),
"toUpdateStacksCount" to stackRepository.countStacksByStateAndOwnerOrganization(StackState.TO_UPDATE, organization))
}
else -> {
mapOf(
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/io/gaia_app/modules/bo/ModuleMetadata.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.gaia_app.modules.bo

import io.gaia_app.teams.User
import io.gaia_app.organizations.User
import org.springframework.data.mongodb.core.mapping.DBRef
import java.time.LocalDateTime

Expand Down
Loading

0 comments on commit e9fb489

Please sign in to comment.