Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: user roles management #669

Closed
wants to merge 33 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
94a60bb
feat(rbac): init user at OAuth2 login
omar-chahbouni-decathlon Oct 28, 2022
7bdf23c
feat(rbac): manage user resources access
omar-chahbouni-decathlon Nov 29, 2022
8638dc1
feat(web-ui): Added front part for admin rights and some user access …
Vincent59 Dec 12, 2022
b6952fa
feat(web-ui): The demo project is not displayed in projects list anym…
Vincent59 Dec 13, 2022
7dbd4a6
fix(rbac): enable github login
omar-chahbouni-decathlon Dec 15, 2022
8789a67
fix(rbac): enable the demo project access for authenticated users
omar-chahbouni-decathlon Dec 21, 2022
22e47b5
feat(rbac): display project creation and update details (date and user)
omar-chahbouni-decathlon Dec 25, 2022
6fa60a2
feat(rbac): link default project to each user
omar-chahbouni-decathlon Dec 27, 2022
e1d9b2c
feat(rbac): fetch user accounts
omar-chahbouni-decathlon Jan 4, 2023
7ab805d
feat(rbac): manage other users scopes
omar-chahbouni-decathlon Jan 13, 2023
50b0477
feat(web-ui): Add member projects part and fix multiple feedback
Vincent59 Jan 18, 2023
29e2e60
feat(web-ui): Add user project service to front and fix some issues
Vincent59 Jan 19, 2023
a1d1494
refactor(rbac): fetch current user details from session
omar-chahbouni-decathlon Jan 19, 2023
c8a3212
feat(rbac): update users profile
omar-chahbouni-decathlon Jan 20, 2023
260627e
feat(web-ui): Add clear default project button and projects filter
Vincent59 Jan 26, 2023
e509437
fix(web-ui): Add warn message if the user need an admin and rework pr…
Vincent59 Jan 30, 2023
ef24893
feat(rbac): add description field to projects
omar-chahbouni-decathlon Jan 28, 2023
8d079e1
fix(web-ui): Rework top menu navigation
Vincent59 Jan 31, 2023
5a16a04
refactor(rbac): change local oauth2 user profile pictures
omar-chahbouni-decathlon Jan 31, 2023
0a3a1a5
fix(web-ui): hide CTA if the user is a member
Vincent59 Feb 1, 2023
2e7a090
refactor(rbac): rename user entity related classes
omar-chahbouni-decathlon Feb 2, 2023
a783142
feat(rbac): create, read, update and read user groups
omar-chahbouni-decathlon Feb 19, 2023
1c0188e
fix(web-ui): rework UX and fix some front issues
Vincent59 Feb 17, 2023
8815645
fix(web-ui): Affect user to a project depending of the profile and is…
Vincent59 Feb 22, 2023
bc0fa67
fix(web-ui): Buttons not showing correctly
Vincent59 Feb 22, 2023
4959603
feat(rbac): manage group members and managers
omar-chahbouni-decathlon Feb 22, 2023
6b737b4
fix(rbac): return updated user account after updating its scope or pr…
omar-chahbouni-decathlon Feb 23, 2023
479e82f
feat(rbac): manage user group scopes
omar-chahbouni-decathlon Mar 1, 2023
8c6848d
feat(web-ui): group management and fix some issues
Vincent59 Mar 1, 2023
5037445
feat: add a dynamic breadcrumb on each pages, personal user page, use…
Vincent59 Mar 7, 2023
0e6e9c2
fix(web-ui): code improvment, fix breadcrumb on refresh, add elements…
Vincent59 Mar 14, 2023
6b0504e
fix(web-ui): rework group management code
Vincent59 Mar 17, 2023
e0cf0ca
feat(rbac): get the actually applied scopes from user and groups
omar-chahbouni-decathlon Mar 6, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(web-ui): Buttons not showing correctly
  • Loading branch information
Vincent59 committed Feb 22, 2023
commit bc0fa67fe76a8b289fb4b1ee86342d6d3845a228
7 changes: 2 additions & 5 deletions code/web-ui/src/components/top-menu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -422,14 +422,11 @@
}
},

beforeUpdate () {
mounted () {
this.loadLocalParameters()
if (localStorage.adminRight === 'true' || this.adminActivated) {
this.$store.dispatch('admin/enableAdmin', 'projects-list')
}
},

mounted () {
this.loadLocalParameters()
Vue.http
.get(api.paths.info, api.REQUEST_OPTIONS)
.then((response) => {
Expand Down
1 change: 1 addition & 0 deletions code/web-ui/src/styles/common.css
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,7 @@ pre code {
display: flex;
margin: 0 auto;
justify-content: center;
text-align: center;
}

.projectCTA .ivu-alert {
Expand Down
111 changes: 61 additions & 50 deletions code/web-ui/src/views/admin-management-members-projects.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,59 +22,70 @@
</div>

<div>
<div v-if="isSuperAdmin || isAdmin" class="projectCTA">
<h2>Project's roles</h2>
<div v-if="this.getMemberInfo.scopes.length > 0">
<div v-if="isSuperAdmin || isAdmin" class="projectCTA">
<h2>Project's roles</h2>

<Button type="primary" class="btn-group-right" @click="userToProject = true">
Affect to a new project
</Button>
</div>
<table class="adminTable" aria-label="User's project and his role for each of them">
<thead>
<tr>
<th>Name</th>
<th>Role</th>
<th></th>
</tr>
</thead>
<tbody v-if="members">
<tr v-for="(scope, index) in (isAdmin ? sortedProjects : this.getMemberInfo.scopes)" :key="index" :class="index %2 !== 0 ? 'lightGrey' : 'darkGrey'">
<td class="userType">
{{ scope.project }}
</td>
<Button type="primary" class="btn-group-right" @click="userToProject = true">
Affect to a new project
</Button>
</div>
<table class="adminTable" aria-label="User's project and his role for each of them">
<thead>
<tr>
<th>Name</th>
<th>Role</th>
<th></th>
</tr>
</thead>
<tbody v-if="members">
<tr v-for="(scope, index) in (isAdmin ? sortedProjects : this.getMemberInfo.scopes)" :key="index" :class="index %2 !== 0 ? 'lightGrey' : 'darkGrey'">
<td class="userType">
{{ scope.project }}
</td>

<td class="userType">
<ul class="user-project-roles">
<li class="user-role-chip"
@click="changeProfile({ member: getMemberInfo, project: scope.project, role: 'MEMBER'})"
:class="scope.role === 'MEMBER' ? ' active' : ''">
<span v-if="scope.role === 'MEMBER'"><Icon type="md-checkmark" /></span>
Member
</li>
<li class="user-role-chip"
@click="changeProfile({ member: getMemberInfo, project: scope.project, role: 'MAINTAINER'})"
:class="scope.role === 'MAINTAINER' ? ' active' : ''">
<span v-if="scope.role === 'MAINTAINER'"><Icon type="md-checkmark" /></span>
Maintainer
</li>
<li class="user-role-chip"
@click="changeProfile({ member: getMemberInfo, project: scope.project, role: 'ADMIN'})"
:class="scope.role === 'ADMIN' ? ' active' : ''">
<span v-if="scope.role === 'ADMIN'"><Icon type="md-checkmark" /></span>
Admin
</li>
</ul>
</td>

<td class="userType">
<ul class="user-project-roles">
<li class="user-role-chip"
@click="changeProfile({ member: getMemberInfo, project: scope.project, role: 'MEMBER'})"
:class="scope.role === 'MEMBER' ? ' active' : ''">
<span v-if="scope.role === 'MEMBER'"><Icon type="md-checkmark" /></span>
Member
</li>
<li class="user-role-chip"
@click="changeProfile({ member: getMemberInfo, project: scope.project, role: 'MAINTAINER'})"
:class="scope.role === 'MAINTAINER' ? ' active' : ''">
<span v-if="scope.role === 'MAINTAINER'"><Icon type="md-checkmark" /></span>
Maintainer
</li>
<li class="user-role-chip"
@click="changeProfile({ member: getMemberInfo, project: scope.project, role: 'ADMIN'})"
:class="scope.role === 'ADMIN' ? ' active' : ''">
<span v-if="scope.role === 'ADMIN'"><Icon type="md-checkmark" /></span>
Admin
</li>
</ul>
</td>
<td class="remove-member-project-btn">
<Icon type="md-close-circle" size="32" @click="changeProfile({
remove: true,
project: scope.project
})" />
</td>
</tr>
</tbody>
</table>
</div>

<td class="remove-member-project-btn">
<Icon type="md-close-circle" size="32" @click="changeProfile({
remove: true,
project: scope.project
})" />
</td>
</tr>
</tbody>
</table>
<div v-else class="projectCTA">
<span>
<Alert type="warning">This member is not affected to any project yet. Click the button below:</Alert>
<Button type="primary" @click="userToProject = true" >
Affect to a new project
</Button>
</span>
</div>
</div>

<Modal v-model="userToProject" title="Affect to a new project" okText="Add" footer-hide @on-ok="changeProfile" @close="userToProject = false" :width="900"
Expand Down
21 changes: 13 additions & 8 deletions code/web-ui/src/views/admin-management-members.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
</div>
</div>


<table class="adminTable" aria-label="Users with their roles and projects">
<thead>
<tr v-if="memberType === 'Members'">
Expand Down Expand Up @@ -203,7 +202,8 @@
this.members.push(user)
}
}
return this.members

return this.members.sort((a, b) => a.login.localeCompare(b.login))
})
},

Expand Down Expand Up @@ -256,12 +256,18 @@
isManagerOf (scopes) {
const adminProject = this.currentUser.scopes.filter(project => project.role === 'ADMIN')

return scopes.some(admin => adminProject.find(project => project.project === admin.project))
if (this.isAdmin) {
return true
} else {
return scopes.some(admin => adminProject.find(project => project.project === admin.project))
}
},

isMe (user) {
if (user === this.currentUser.login) {
return true
} else {
return false
}
}
},
Expand All @@ -271,11 +277,6 @@
},

computed: {
sortedMembers () {
this.$store.dispatch('admin/showSubMenuMembers', false)
return this.members.map(item => item).sort((a, b) => a.id - b.id)
},

currentUser () {
return AuthenticationService.getDetails().user
},
Expand All @@ -284,6 +285,10 @@
return this.currentUser.scopes.some(({ role }) => role === 'ADMIN')
},

isAdmin () {
return this.currentUser.profile === 'SUPER_ADMIN'
},

isNotAuditor () {
return this.currentUser.profile !== 'AUDITOR'
},
Expand Down
2 changes: 1 addition & 1 deletion code/web-ui/src/views/admin-management.vue
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@
},

openProjectDetails (projectInfo) {
this.$router.push({ name: 'admin-project-details', params: { projectCode: projectInfo.code, projectName: projectInfo.name, userRole: projectInfo.currentUserRole } })
this.$router.push({ name: 'admin-project-details', params: { projectCode: projectInfo.code, projectName: projectInfo.name, userRole: this.user.profile } })
},

async initProjects () {
Expand Down
10 changes: 7 additions & 3 deletions code/web-ui/src/views/admin-project-details.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<div class="projectCTA">
<h2 v-if="!emptyProject">Project's members</h2>

<span :class="isMember ? 'hidden' : ''">
<span :class="isMember ? 'hidden' : isAuditor ? 'hidden' : ''">
<Alert v-if="emptyProject" type="warning" class="btn-group-right">There are no members to show in this projects</Alert>
<Button title="Add" type="primary" ghost class="btn-group-right" @click="memberToAdd = true">Add member</Button>
<Button title="Edit" type="primary" class="btn-group-right" ghost>Edit project</Button>
Expand All @@ -56,8 +56,8 @@
<td >{{ isMe(member.login) }}</td>
<td>{{ getUserRole(member.scopes) }}</td>
<td class="table-cta">
<Icon v-if="!isMember" type="md-close-circle" class="crossIcon" size="24" @click="removeUserFromProject(member)" />
<Icon v-if="!isMember" type="md-create" size="24" @click="openProjectDetails(project)" />
<Icon v-if="!isMember && !isAuditor" type="md-close-circle" class="crossIcon" size="24" @click="removeUserFromProject(member)" />
<Icon v-if="!isMember && !isAuditor" type="md-create" size="24" @click="openProjectDetails(project)" />
</td>
</tr>
</tbody>
Expand Down Expand Up @@ -230,6 +230,10 @@

isMember () {
return this.$route.params.userRole === USER.ROLE_ON_PROJECT.MEMBER
},

isAuditor () {
return this.$route.params.userRole === USER.PROFILE.AUDITOR
}
},

Expand Down