[WEB-2357] fix: update and redefine user roles across the platform (#5466)

* chore: removed viewer role

* chore: indentation

* chore: remove viewer role

* chore: handled user permissions in store

* chore: updated the migration file

* chore: updated user permissions store

* chore: removed the owner key

* chore: code refactor

* chore: code refactor

* chore: code refactor

* chore: code refactor

* chore: code refactor

* fix: build error

* chore: updated user permissions store and handled the permissions fetch in workspace and project wrappers

* chore: package user enum updated

* chore: user permission updated

* chore: user permission updated

* chore: resolved build errors

* chore: resolved build error

* chore: resolved build errors

* chore: computedFn deep map issue resolved

* chore: added back migration

* chore: added new field in project table

* chore: removed member store in users

* chore: private project for admins

* chore: workspace notification access validation updated

* fix: workspace member edit option

* fix: project intake permission validation updated

* chore: workspace export settings permission updated

* chore: guest_view_all_issues added

* chore: guest_view_all_issues added

* chore: key changed for guest access

* chore: added validation for individual issues

* chore: changed the dashboard issues count

* chore: added new yarn file

* chore: modified yarn file

* chore: project page permission updated

* chore: project page permission updated

* chore: member setting ux updated

* chore: build error

* fix: yarn lock

* fix: build error

---------

Co-authored-by: gurusainath <gurusainath007@gmail.com>
Co-authored-by: Anmol Singh Bhatia <anmolsinghbhatia@plane.so>
This commit is contained in:
Bavisetti Narayan 2024-09-11 17:10:15 +05:30 committed by GitHub
parent 7013a36629
commit fdcd9a376c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
172 changed files with 2057 additions and 1627 deletions

View file

@ -1,10 +1,14 @@
export enum EUserProjectRoles {
GUEST = 5,
VIEWER = 10,
MEMBER = 15,
export enum EUserPermissions {
ADMIN = 20,
MEMBER = 15,
GUEST = 5,
}
export type TUserPermissions =
| EUserPermissions.ADMIN
| EUserPermissions.MEMBER
| EUserPermissions.GUEST;
// project pages
export enum EPageAccess {
PUBLIC = 0,

View file

@ -1,4 +1,3 @@
import { EUserProjectRoles } from "@/constants/project";
import type {
IProjectViewProps,
IUser,
@ -9,6 +8,7 @@ import type {
TLogoProps,
TStateGroups,
} from "..";
import { TUserPermissions } from "../enums";
export interface IProject {
archive_in: number;
@ -30,6 +30,7 @@ export interface IProject {
draft_issues: number;
draft_sub_issues: number;
estimate: string | null;
guest_view_all_features: boolean;
id: string;
identifier: string;
anchor: string | null;
@ -38,7 +39,7 @@ export interface IProject {
is_member: boolean;
is_time_tracking_enabled: boolean;
logo_props: TLogoProps;
member_role: EUserProjectRoles | null;
member_role: TUserPermissions | null;
members: IProjectMemberLite[];
name: string;
network: number;
@ -85,7 +86,7 @@ export interface IProjectMember {
project: IProjectLite;
workspace: IWorkspaceLite;
comment: string;
role: EUserProjectRoles;
role: TUserPermissions;
preferences: ProjectPreferences;
@ -101,11 +102,11 @@ export interface IProjectMember {
export interface IProjectMembership {
id: string;
member: string;
role: EUserProjectRoles;
role: TUserPermissions;
}
export interface IProjectBulkAddFormData {
members: { role: EUserProjectRoles; member_id: string }[];
members: { role: TUserPermissions; member_id: string }[];
}
export interface IGithubRepository {

View file

@ -1,9 +1,5 @@
import {
EUserProjectRoles,
IIssueActivity,
TIssuePriorities,
TStateGroups,
} from ".";
import { IIssueActivity, TIssuePriorities, TStateGroups } from ".";
import { TUserPermissions } from "./enums";
type TLoginMediums = "email" | "magic-code" | "github" | "gitlab" | "google";
@ -134,7 +130,6 @@ export interface IUserActivityResponse {
export type UserAuth = {
isMember: boolean;
isOwner: boolean;
isViewer: boolean;
isGuest: boolean;
};
@ -175,7 +170,7 @@ export interface IUserProfileProjectSegregation {
}
export interface IUserProjectsRole {
[projectId: string]: EUserProjectRoles;
[projectId: string]: TUserPermissions;
}
export interface IUserEmailNotificationSettings {

View file

@ -1,4 +1,3 @@
import {EUserWorkspaceRoles} from "@/constants/workspace";
import type {
ICycle,
IProjectMember,
@ -6,6 +5,7 @@ import type {
IUserLite,
IWorkspaceViewProps,
} from "@plane/types";
import { TUserPermissions } from "./enums";
export interface IWorkspace {
readonly id: string;
@ -36,7 +36,7 @@ export interface IWorkspaceMemberInvitation {
id: string;
message: string;
responded_at: Date;
role: EUserWorkspaceRoles;
role: TUserPermissions;
token: string;
workspace: {
id: string;
@ -47,7 +47,7 @@ export interface IWorkspaceMemberInvitation {
}
export interface IWorkspaceBulkInviteFormData {
emails: {email: string; role: EUserWorkspaceRoles}[];
emails: { email: string; role: TUserPermissions }[];
}
export type Properties = {
@ -69,7 +69,7 @@ export type Properties = {
export interface IWorkspaceMember {
id: string;
member: IUserLite;
role: EUserWorkspaceRoles;
role: TUserPermissions;
created_at?: string;
avatar?: string;
email?: string;
@ -86,7 +86,7 @@ export interface IWorkspaceMemberMe {
default_props: IWorkspaceViewProps;
id: string;
member: string;
role: EUserWorkspaceRoles;
role: TUserPermissions;
updated_at: Date;
updated_by: string;
view_props: IWorkspaceViewProps;

View file

@ -58,7 +58,7 @@ const ComboDropDown = forwardRef((props: Props, ref) => {
}
return (
//@ts-ignore
// @ts-ignore
<Combobox {...rest} ref={ref}>
<Combobox.Button as={Fragment}>{button}</Combobox.Button>
{children}
@ -70,4 +70,6 @@ const ComboOptions = Combobox.Options;
const ComboOption = Combobox.Option;
const ComboInput = Combobox.Input;
ComboDropDown.displayName = "ComboDropDown";
export { ComboDropDown, ComboOptions, ComboOption, ComboInput };