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

Allow editor/writer to change project user permissions and accessibility #5375

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ const downloadMenuItem = {
};

const projectMenuItems = computed(() => {
// Basic access to public and reader project
// Basic access to a public and reader project
const items: MenuItem[] = [copyMenuItem, downloadMenuItem];

// Creator/Editor of the project
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
@after-hide="onAfterHide"
:style="{ width: '35rem' }"
>
<section class="container">
<section class="mr-2">
<Dropdown
v-model="selectedUser"
:options="usersMenu"
Expand Down Expand Up @@ -252,20 +252,16 @@ watch(
</script>

<style scoped>
.container {
margin-right: 0.5rem;
}

section {
padding-top: 0.5rem;
padding-top: var(--gap-2);
}

section > section {
padding-top: 1rem;
padding-top: var(--gap-4);
}

h6 {
margin-bottom: 0.5rem;
margin-bottom: var(--gap-2);
}

.accessibility {
Expand All @@ -281,13 +277,13 @@ h6 {
li {
list-style: none;
display: flex;
gap: 0.5rem;
gap: var(--gap-2);
}

.general-access-option {
display: flex;
align-items: center;
gap: 0.5rem;
gap: var(--gap-2);
}

.caption {
Expand All @@ -296,6 +292,6 @@ li {
}

.p-dropdown {
margin-bottom: 0.5rem;
margin-bottom: var(--gap-2);
}
</style>
12 changes: 3 additions & 9 deletions packages/client/hmi-client/src/composables/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,22 +149,16 @@ export function useProjects() {
}

/**
* Update a project. If updated project is the active project, refresh it.
*
* @param {Project} project Project to update.
* @returns {Promise<string>} Id of the updated project.
* Update a project. If the updated project is the active project, refresh it.
*/
async function update(project: Project) {
const updated = await ProjectService.update(project);
await ProjectService.update(project);
if (project.id === activeProjectId.value) {
setTimeout(async () => {
activeProject.value = await ProjectService.get(project.id);
}, 1000);
}
setTimeout(async () => {
getAll();
}, TIMEOUT_MS);
return updated;
setTimeout(getAll, TIMEOUT_MS);
}

/**
Expand Down
1 change: 1 addition & 0 deletions packages/client/hmi-client/src/services/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import type { Component, Ref } from 'vue';
* Create a project
* @param name Project['name']
* @param [description] Project['description']
* @param thumbnail
* @return Project|null - the appropriate project, or null if none returned by API
*/
async function create(
Expand Down
2 changes: 1 addition & 1 deletion packages/client/hmi-client/src/types/Types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -801,9 +801,9 @@ export interface ModelUnit {
}

export interface GroundedSemantic {
grounding?: ModelGrounding;
id: string;
name?: string;
grounding?: ModelGrounding;
YohannParis marked this conversation as resolved.
Show resolved Hide resolved
}

export interface Properties {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1088,7 +1088,7 @@ public ResponseEntity<JsonNode> makeProjectPublic(
@PathVariable("isPublic") final boolean isPublic
) {
try {
projectService.checkPermissionCanAdministrate(currentUserService.get().getId(), id);
projectService.checkPermissionCanWrite(currentUserService.get().getId(), id);

// Getting the project permissions
final RebacProject project = new RebacProject(id, reBACService);
Expand Down Expand Up @@ -1148,7 +1148,7 @@ public ResponseEntity<JsonNode> setProjectUserPermissions(
@PathVariable("relationship") final String relationship
) {
try {
projectService.checkPermissionCanAdministrate(currentUserService.get().getId(), projectId);
projectService.checkPermissionCanWrite(currentUserService.get().getId(), projectId);

final RebacProject what = new RebacProject(projectId, reBACService);
final RebacUser who = new RebacUser(userId, reBACService);
Expand Down
Loading