@nexttylabs/echo 0.5.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -0
- package/app/(auth)/login/page.tsx +1 -1
- package/app/(auth)/register/page.tsx +1 -1
- package/app/(auth)/sign-in/page.tsx +1 -1
- package/app/(dashboard)/admin/feedback/[id]/edit/page.tsx +13 -7
- package/app/(dashboard)/admin/feedback/[id]/page.tsx +1 -1
- package/app/(dashboard)/admin/feedback/new/page.tsx +20 -18
- package/app/(dashboard)/admin/feedback/page.tsx +1 -1
- package/app/(dashboard)/admin/layout.tsx +17 -7
- package/app/(dashboard)/analytics/portal/page.tsx +1 -1
- package/app/(dashboard)/dashboard/page.tsx +1 -1
- package/app/(dashboard)/layout.tsx +5 -3
- package/app/(dashboard)/no-access/page.tsx +1 -1
- package/app/(dashboard)/settings/access/page.tsx +1 -1
- package/app/(dashboard)/settings/api-keys/page.tsx +14 -4
- package/app/(dashboard)/settings/appearance/page.tsx +1 -1
- package/app/(dashboard)/settings/branding/page.tsx +1 -1
- package/app/(dashboard)/settings/changelog/page.tsx +1 -1
- package/app/(dashboard)/settings/danger-zone/page.tsx +1 -1
- package/app/(dashboard)/settings/feedback/page.tsx +1 -1
- package/app/(dashboard)/settings/integrations/page.tsx +1 -1
- package/app/(dashboard)/settings/layout.tsx +26 -3
- package/app/(dashboard)/settings/modules/page.tsx +1 -1
- package/app/(dashboard)/settings/notifications/page.tsx +1 -1
- package/app/(dashboard)/settings/organization/page.tsx +9 -10
- package/app/(dashboard)/settings/organization/portal/access/page.tsx +1 -1
- package/app/(dashboard)/settings/organization/portal/experience/page.tsx +1 -1
- package/app/(dashboard)/settings/organization/portal/growth/page.tsx +1 -1
- package/app/(dashboard)/settings/organization/portal/layout.tsx +1 -1
- package/app/(dashboard)/settings/organization/portal/page.tsx +1 -1
- package/app/(dashboard)/settings/organizations/[orgId]/members/page.tsx +1 -1
- package/app/(dashboard)/settings/organizations/new/page.tsx +1 -1
- package/app/(dashboard)/settings/page.tsx +1 -1
- package/app/(dashboard)/settings/portal-access/page.tsx +1 -1
- package/app/(dashboard)/settings/portal-branding/page.tsx +1 -1
- package/app/(dashboard)/settings/portal-growth/page.tsx +1 -1
- package/app/(dashboard)/settings/portal-modules/page.tsx +1 -1
- package/app/(dashboard)/settings/portal-resources/page.tsx +1 -1
- package/app/(dashboard)/settings/profile/page.tsx +1 -1
- package/app/(dashboard)/settings/widgets/page.tsx +1 -1
- package/app/(public)/[organizationSlug]/changelog/page.tsx +1 -1
- package/app/(public)/[organizationSlug]/feedback/[id]/page.tsx +1 -1
- package/app/(public)/[organizationSlug]/page.tsx +1 -1
- package/app/(public)/[organizationSlug]/roadmap/page.tsx +1 -1
- package/app/(public)/docs/page.tsx +1 -1
- package/app/(public)/feedback/[id]/not-found.tsx +1 -1
- package/app/(public)/feedback/[id]/page.tsx +1 -1
- package/app/(public)/invite/[token]/page.tsx +1 -1
- package/app/(public)/page.tsx +1 -1
- package/app/(public)/widget/[organizationId]/page.tsx +1 -1
- package/app/api/_utils.ts +1 -1
- package/app/api/admin/backup/route.ts +1 -1
- package/app/api/api-keys/[keyId]/route.ts +1 -1
- package/app/api/api-keys/route.ts +1 -1
- package/app/api/auth/[...all]/route.ts +1 -1
- package/app/api/auth/clear-session/route.ts +1 -1
- package/app/api/auth/register/handler.ts +1 -1
- package/app/api/auth/register/route.ts +1 -1
- package/app/api/docs/route.ts +1 -1
- package/app/api/feedback/[id]/comments/[commentId]/route.ts +14 -5
- package/app/api/feedback/[id]/comments/route.ts +1 -1
- package/app/api/feedback/[id]/duplicates/route.ts +1 -1
- package/app/api/feedback/[id]/handler.ts +1 -1
- package/app/api/feedback/[id]/processing-status/route.ts +1 -1
- package/app/api/feedback/[id]/reclassify/route.ts +5 -5
- package/app/api/feedback/[id]/route.ts +1 -1
- package/app/api/feedback/[id]/suggest-tags/route.ts +1 -1
- package/app/api/feedback/[id]/sync-github/route.ts +1 -1
- package/app/api/feedback/[id]/vote/route.ts +1 -1
- package/app/api/feedback/bulk/route.ts +1 -1
- package/app/api/feedback/handler.ts +1 -1
- package/app/api/feedback/route.ts +1 -1
- package/app/api/feedback/similar/route.ts +1 -1
- package/app/api/health/route.test.ts +1 -1
- package/app/api/health/route.ts +1 -1
- package/app/api/identify/jwt/route.ts +1 -1
- package/app/api/integrations/github/route.ts +1 -1
- package/app/api/invitations/accept/handler.ts +1 -1
- package/app/api/invitations/accept/route.ts +1 -1
- package/app/api/notifications/preferences/route.ts +1 -1
- package/app/api/organizations/[orgId]/handler.ts +1 -1
- package/app/api/organizations/[orgId]/invitations/handler.ts +1 -1
- package/app/api/organizations/[orgId]/invitations/route.ts +1 -1
- package/app/api/organizations/[orgId]/members/[memberId]/handler.ts +1 -1
- package/app/api/organizations/[orgId]/members/[memberId]/route.ts +1 -1
- package/app/api/organizations/[orgId]/members/handler.ts +1 -1
- package/app/api/organizations/[orgId]/members/route.ts +1 -1
- package/app/api/organizations/[orgId]/route.ts +1 -1
- package/app/api/organizations/handler.ts +3 -5
- package/app/api/organizations/route.ts +1 -1
- package/app/api/tags/sync/route.ts +1 -1
- package/app/api/upload/handler.ts +1 -1
- package/app/api/upload/route.ts +1 -1
- package/app/api/v1/feedback/[id]/route.ts +1 -1
- package/app/api/v1/feedback/route.ts +1 -1
- package/app/api/v1/spec/route.ts +1 -1
- package/app/api/webhooks/[webhookId]/route.ts +1 -1
- package/app/api/webhooks/github/route.ts +1 -1
- package/app/api/webhooks/route.ts +1 -1
- package/app/health/route.ts +1 -1
- package/app/layout.tsx +11 -3
- package/components/api/rate-limit-info.tsx +1 -1
- package/components/api-keys/api-key-manager.tsx +1 -1
- package/components/auth/login-form.tsx +1 -1
- package/components/auth/register-form.tsx +1 -1
- package/components/comment/comment-form.tsx +1 -1
- package/components/comment/internal-notes.tsx +1 -1
- package/components/comment/public-comments.tsx +1 -1
- package/components/component-example-client-only.tsx +1 -1
- package/components/component-example.tsx +1 -1
- package/components/dashboard/index.ts +1 -1
- package/components/dashboard/organization-switcher.tsx +1 -1
- package/components/dashboard/quick-actions.tsx +1 -1
- package/components/dashboard/recent-feedback-list.tsx +1 -1
- package/components/dashboard/stats-cards.tsx +1 -1
- package/components/dashboard/status-chart.tsx +1 -1
- package/components/example.tsx +1 -1
- package/components/feedback/attachment-list.tsx +1 -1
- package/components/feedback/auto-classification-badge.tsx +1 -1
- package/components/feedback/classification-override.tsx +1 -1
- package/components/feedback/duplicate-suggestions-inline.tsx +1 -1
- package/components/feedback/duplicate-suggestions.tsx +1 -1
- package/components/feedback/embedded-feedback-form.tsx +1 -1
- package/components/feedback/feedback-actions.tsx +1 -1
- package/components/feedback/feedback-bulk-actions.tsx +1 -1
- package/components/feedback/feedback-detail-view.tsx +1 -1
- package/components/feedback/feedback-detail.tsx +1 -1
- package/components/feedback/feedback-edit-form.tsx +1 -1
- package/components/feedback/feedback-filters.tsx +1 -1
- package/components/feedback/feedback-list-controls.tsx +1 -1
- package/components/feedback/feedback-list-item.tsx +1 -1
- package/components/feedback/feedback-list-skeleton.tsx +1 -1
- package/components/feedback/feedback-list.tsx +1 -1
- package/components/feedback/feedback-sorter.tsx +1 -1
- package/components/feedback/feedback-stats.tsx +1 -1
- package/components/feedback/file-upload.tsx +1 -1
- package/components/feedback/processing-status.tsx +1 -1
- package/components/feedback/status-history.tsx +1 -1
- package/components/feedback/status-selector.tsx +1 -1
- package/components/feedback/submit-on-behalf-form.tsx +1 -1
- package/components/feedback/tag-suggestions.tsx +1 -1
- package/components/feedback/vote-button.tsx +1 -1
- package/components/feedback/vote-list.tsx +1 -1
- package/components/integrations/github-config.tsx +1 -1
- package/components/landing/hero.tsx +1 -1
- package/components/layout/dashboard-layout.tsx +1 -1
- package/components/layout/index.ts +1 -1
- package/components/layout/language-switcher.tsx +1 -1
- package/components/layout/mobile-sidebar.tsx +1 -1
- package/components/layout/sidebar.tsx +1 -1
- package/components/portal/changelog-entry.tsx +1 -1
- package/components/portal/changelog-list.tsx +1 -1
- package/components/portal/contributor-badge.tsx +1 -1
- package/components/portal/contributors-sidebar.tsx +1 -1
- package/components/portal/create-post-dialog.tsx +1 -1
- package/components/portal/feedback-board.tsx +1 -1
- package/components/portal/feedback-post-card.tsx +1 -1
- package/components/portal/help-center.tsx +1 -1
- package/components/portal/leaderboard.tsx +1 -1
- package/components/portal/portal-header.tsx +1 -1
- package/components/portal/portal-layout.tsx +1 -1
- package/components/portal/portal-modules-panel.tsx +1 -1
- package/components/portal/portal-nav.tsx +1 -1
- package/components/portal/portal-overview.tsx +1 -1
- package/components/portal/portal-settings-nav.tsx +1 -1
- package/components/portal/portal-settings-shell.tsx +1 -1
- package/components/portal/portal-shell.tsx +1 -1
- package/components/portal/portal-tab-nav.tsx +1 -1
- package/components/portal/roadmap-board.tsx +1 -1
- package/components/portal/roadmap-card.tsx +1 -1
- package/components/portal/roadmap-column.tsx +1 -1
- package/components/portal/settings-forms/access-form.tsx +1 -1
- package/components/portal/settings-forms/copy-form.tsx +1 -1
- package/components/portal/settings-forms/index.ts +1 -1
- package/components/portal/settings-forms/languages-form.tsx +1 -1
- package/components/portal/settings-forms/seo-form.tsx +1 -1
- package/components/portal/settings-forms/sharing-form.tsx +1 -1
- package/components/portal/settings-forms/theme-form.tsx +1 -1
- package/components/settings/api-keys-list.tsx +1 -1
- package/components/settings/appearance-form.tsx +4 -6
- package/components/settings/index.ts +1 -1
- package/components/settings/invite-member-form.tsx +1 -1
- package/components/settings/notification-preferences.tsx +1 -1
- package/components/settings/organization-form.tsx +1 -1
- package/components/settings/organization-members-list.tsx +1 -1
- package/components/settings/profile-form.tsx +1 -1
- package/components/settings/role-selector.tsx +1 -1
- package/components/settings/settings-sidebar.tsx +5 -5
- package/components/shared/pagination.tsx +1 -1
- package/components/theme-provider.tsx +28 -0
- package/components/ui/alert-dialog.tsx +1 -1
- package/components/ui/alert.tsx +1 -1
- package/components/ui/avatar.tsx +1 -1
- package/components/ui/badge.tsx +1 -1
- package/components/ui/button.tsx +1 -1
- package/components/ui/card.tsx +1 -1
- package/components/ui/combobox.tsx +1 -1
- package/components/ui/dialog.tsx +1 -1
- package/components/ui/dropdown-menu.tsx +1 -1
- package/components/ui/field.tsx +1 -1
- package/components/ui/input-group.tsx +1 -1
- package/components/ui/input.tsx +1 -1
- package/components/ui/label.tsx +1 -1
- package/components/ui/pagination.tsx +1 -1
- package/components/ui/select.tsx +1 -1
- package/components/ui/separator.tsx +1 -1
- package/components/ui/sheet.tsx +1 -1
- package/components/ui/skeleton.tsx +1 -1
- package/components/ui/switch.tsx +1 -1
- package/components/ui/table.tsx +1 -1
- package/components/ui/tabs.tsx +1 -1
- package/components/ui/textarea.tsx +1 -1
- package/components/ui/tooltip.tsx +1 -1
- package/components/widget/widget-form.tsx +1 -1
- package/drizzle.config.ts +1 -1
- package/hooks/use-organization.tsx +116 -0
- package/hooks/use-permissions.ts +25 -12
- package/i18n/config.ts +1 -1
- package/i18n/request.ts +1 -1
- package/i18n/resolve-locale.ts +1 -1
- package/lib/api/errors.ts +1 -1
- package/lib/auth/cli-config.ts +1 -1
- package/lib/auth/client.ts +1 -1
- package/lib/auth/config.ts +1 -1
- package/lib/auth/jwt-identity.ts +1 -1
- package/lib/auth/org-context.ts +1 -1
- package/lib/auth/organization.ts +21 -1
- package/lib/auth/permissions.ts +11 -1
- package/lib/auth/session.ts +1 -1
- package/lib/config/rate-limits.ts +1 -1
- package/lib/dashboard/get-dashboard-stats.ts +1 -1
- package/lib/db/index.ts +1 -1
- package/lib/db/migrate.test.ts +1 -1
- package/lib/db/migrate.ts +1 -1
- package/lib/db/schema/ai-processing.ts +1 -1
- package/lib/db/schema/api-keys.ts +1 -1
- package/lib/db/schema/attachments.ts +1 -1
- package/lib/db/schema/auth.ts +1 -1
- package/lib/db/schema/comments.ts +1 -1
- package/lib/db/schema/duplicates.ts +1 -1
- package/lib/db/schema/feedback.ts +1 -1
- package/lib/db/schema/github-integrations.ts +1 -1
- package/lib/db/schema/index.ts +1 -1
- package/lib/db/schema/invitations.ts +1 -1
- package/lib/db/schema/notifications.ts +1 -1
- package/lib/db/schema/organization-members.ts +1 -1
- package/lib/db/schema/organization-settings.ts +1 -1
- package/lib/db/schema/organizations.ts +1 -1
- package/lib/db/schema/status-history.ts +1 -1
- package/lib/db/schema/tags.ts +1 -1
- package/lib/db/schema/votes.ts +1 -1
- package/lib/db/schema/webhooks.ts +1 -1
- package/lib/feedback/filters.ts +1 -1
- package/lib/feedback/find-similar.ts +1 -1
- package/lib/feedback/get-feedback-by-id.ts +1 -1
- package/lib/feedback/prefill.ts +1 -1
- package/lib/http/get-request-url.ts +1 -1
- package/lib/integrations/github.ts +1 -1
- package/lib/invitations.ts +1 -1
- package/lib/logger.test.ts +1 -1
- package/lib/logger.ts +1 -1
- package/lib/middleware/api-key.ts +1 -1
- package/lib/middleware/rate-limit-keys.ts +1 -1
- package/lib/middleware/rate-limit.ts +1 -1
- package/lib/middleware/rbac.ts +1 -1
- package/lib/middleware/request-id.test.ts +1 -1
- package/lib/middleware/request-id.ts +1 -1
- package/lib/middleware/request-logger.test.ts +1 -1
- package/lib/middleware/request-logger.ts +1 -1
- package/lib/middleware/with-rate-limit.ts +1 -1
- package/lib/portal/analytics.ts +1 -1
- package/lib/portal/contributors.ts +1 -1
- package/lib/portal/i18n.ts +1 -1
- package/lib/portal/leaderboard-settings.ts +1 -1
- package/lib/portal/modules.ts +1 -1
- package/lib/portal/portal-copy.ts +1 -1
- package/lib/portal/public-context.tsx +1 -1
- package/lib/portal/seo.ts +1 -1
- package/lib/portal/settings-context.ts +1 -1
- package/lib/portal/sharing.ts +1 -1
- package/lib/portal/sorting.ts +1 -1
- package/lib/portal/theme.ts +1 -1
- package/lib/services/ai/classifier.ts +1 -1
- package/lib/services/ai/duplicate-detector.ts +1 -1
- package/lib/services/ai/tag-suggester.ts +1 -1
- package/lib/services/api-keys.ts +1 -1
- package/lib/services/backup.ts +1 -1
- package/lib/services/email/templates.ts +1 -1
- package/lib/services/email.ts +1 -1
- package/lib/services/github-sync.ts +1 -1
- package/lib/services/notifications/index.ts +1 -1
- package/lib/services/portal-settings.ts +1 -1
- package/lib/swagger/config.ts +1 -1
- package/lib/swagger/generate.ts +1 -1
- package/lib/upload/file-validator.ts +1 -1
- package/lib/upload/storage.ts +1 -1
- package/lib/utils/format.ts +1 -1
- package/lib/utils/slug.ts +1 -1
- package/lib/utils.ts +1 -1
- package/lib/validations/auth.ts +1 -1
- package/lib/validations/comment.ts +1 -1
- package/lib/validations/feedback.ts +1 -1
- package/lib/validations/invitations.ts +1 -1
- package/lib/validations/organizations.ts +1 -1
- package/lib/validators/feedback.ts +1 -1
- package/lib/validators/index.ts +1 -1
- package/lib/webhooks/events.ts +1 -1
- package/lib/webhooks/index.ts +1 -1
- package/lib/webhooks/retry.ts +1 -1
- package/lib/webhooks/sender.ts +1 -1
- package/lib/webhooks/verify.ts +1 -1
- package/lib/workers/feedback-processor.ts +1 -1
- package/next.config.ts +1 -1
- package/package.json +2 -1
- package/types/bun-test.d.ts +1 -1
package/hooks/use-permissions.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
/*
|
|
5
|
-
* Copyright (c) 2026
|
|
5
|
+
* Copyright (c) 2026 Nexttylabs Team
|
|
6
6
|
*
|
|
7
7
|
* This program is free software: you can redistribute it and/or modify
|
|
8
8
|
* it under the terms of the GNU Affero General Public License as published by
|
|
@@ -18,34 +18,46 @@
|
|
|
18
18
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
|
-
import { authClient } from "@/lib/auth/client";
|
|
22
21
|
import {
|
|
23
22
|
hasAllPermissions,
|
|
24
23
|
hasPermission,
|
|
25
24
|
type Permission,
|
|
26
25
|
type UserRole,
|
|
27
26
|
} from "@/lib/auth/permissions";
|
|
27
|
+
import { useCurrentRole } from "@/hooks/use-organization";
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
/**
|
|
30
|
+
* Check if the current user has a specific permission.
|
|
31
|
+
* Uses the user's role in the current organization from OrganizationProvider context.
|
|
32
|
+
*
|
|
33
|
+
* @param permission - The permission to check
|
|
34
|
+
* @param roleOverride - Optional role to use instead of the context role
|
|
35
|
+
* @returns true if the user has the permission
|
|
36
|
+
*/
|
|
31
37
|
export function useCan(
|
|
32
38
|
permission: Permission,
|
|
33
|
-
|
|
39
|
+
roleOverride?: UserRole | null,
|
|
34
40
|
): boolean {
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
const role = (session?.user as { role?: UserRole })?.role;
|
|
41
|
+
const contextRole = useCurrentRole();
|
|
42
|
+
const role = roleOverride ?? contextRole;
|
|
38
43
|
|
|
39
44
|
return role ? hasPermission(role, permission) : false;
|
|
40
45
|
}
|
|
41
46
|
|
|
47
|
+
/**
|
|
48
|
+
* Check if the current user has all of the specified permissions.
|
|
49
|
+
* Uses the user's role in the current organization from OrganizationProvider context.
|
|
50
|
+
*
|
|
51
|
+
* @param permissions - Single permission or array of permissions to check
|
|
52
|
+
* @param roleOverride - Optional role to use instead of the context role
|
|
53
|
+
* @returns true if the user has all permissions
|
|
54
|
+
*/
|
|
42
55
|
export function useHasPermission(
|
|
43
56
|
permissions: Permission | Permission[],
|
|
44
|
-
|
|
57
|
+
roleOverride?: UserRole | null,
|
|
45
58
|
): boolean {
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
const role = (session?.user as { role?: UserRole })?.role;
|
|
59
|
+
const contextRole = useCurrentRole();
|
|
60
|
+
const role = roleOverride ?? contextRole;
|
|
49
61
|
|
|
50
62
|
if (!role) {
|
|
51
63
|
return false;
|
|
@@ -54,3 +66,4 @@ export function useHasPermission(
|
|
|
54
66
|
const list = Array.isArray(permissions) ? permissions : [permissions];
|
|
55
67
|
return hasAllPermissions(role, list);
|
|
56
68
|
}
|
|
69
|
+
|
package/i18n/config.ts
CHANGED
package/i18n/request.ts
CHANGED
package/i18n/resolve-locale.ts
CHANGED
package/lib/api/errors.ts
CHANGED
package/lib/auth/cli-config.ts
CHANGED
package/lib/auth/client.ts
CHANGED
package/lib/auth/config.ts
CHANGED
package/lib/auth/jwt-identity.ts
CHANGED
package/lib/auth/org-context.ts
CHANGED
package/lib/auth/organization.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright (c) 2026
|
|
2
|
+
* Copyright (c) 2026 Nexttylabs Team
|
|
3
3
|
*
|
|
4
4
|
* This program is free software: you can redistribute it and/or modify
|
|
5
5
|
* it under the terms of the GNU Affero General Public License as published by
|
|
@@ -19,6 +19,7 @@ import { and, eq } from "drizzle-orm";
|
|
|
19
19
|
import { db } from "@/lib/db";
|
|
20
20
|
import type { db as database } from "@/lib/db";
|
|
21
21
|
import { organizationMembers, organizations } from "@/lib/db/schema";
|
|
22
|
+
import type { UserRole } from "@/lib/auth/permissions";
|
|
22
23
|
|
|
23
24
|
type Database = NonNullable<typeof database>;
|
|
24
25
|
|
|
@@ -105,3 +106,22 @@ export async function getCurrentOrganizationId(userId: string): Promise<string |
|
|
|
105
106
|
const org = await getUserOrganization(db, userId);
|
|
106
107
|
return org?.id || null;
|
|
107
108
|
}
|
|
109
|
+
|
|
110
|
+
export async function getUserRoleInOrganization(
|
|
111
|
+
db: Database,
|
|
112
|
+
userId: string,
|
|
113
|
+
organizationId: string
|
|
114
|
+
): Promise<UserRole | null> {
|
|
115
|
+
const [member] = await db
|
|
116
|
+
.select({ role: organizationMembers.role })
|
|
117
|
+
.from(organizationMembers)
|
|
118
|
+
.where(
|
|
119
|
+
and(
|
|
120
|
+
eq(organizationMembers.userId, userId),
|
|
121
|
+
eq(organizationMembers.organizationId, organizationId)
|
|
122
|
+
)
|
|
123
|
+
)
|
|
124
|
+
.limit(1);
|
|
125
|
+
|
|
126
|
+
return (member?.role as UserRole) || null;
|
|
127
|
+
}
|
package/lib/auth/permissions.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright (c) 2026
|
|
2
|
+
* Copyright (c) 2026 Nexttylabs Team
|
|
3
3
|
*
|
|
4
4
|
* This program is free software: you can redistribute it and/or modify
|
|
5
5
|
* it under the terms of the GNU Affero General Public License as published by
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
18
|
export type UserRole =
|
|
19
|
+
| "owner"
|
|
19
20
|
| "admin"
|
|
20
21
|
| "product_manager"
|
|
21
22
|
| "developer"
|
|
@@ -35,6 +36,15 @@ export const PERMISSIONS = {
|
|
|
35
36
|
export type Permission = (typeof PERMISSIONS)[keyof typeof PERMISSIONS];
|
|
36
37
|
|
|
37
38
|
export const ROLE_PERMISSIONS: Record<UserRole, Permission[]> = {
|
|
39
|
+
owner: [
|
|
40
|
+
PERMISSIONS.CREATE_FEEDBACK,
|
|
41
|
+
PERMISSIONS.SUBMIT_ON_BEHALF,
|
|
42
|
+
PERMISSIONS.DELETE_FEEDBACK,
|
|
43
|
+
PERMISSIONS.MANAGE_ORG,
|
|
44
|
+
PERMISSIONS.UPDATE_FEEDBACK_STATUS,
|
|
45
|
+
PERMISSIONS.BACKUP_CREATE,
|
|
46
|
+
PERMISSIONS.BACKUP_VIEW,
|
|
47
|
+
],
|
|
38
48
|
admin: [
|
|
39
49
|
PERMISSIONS.CREATE_FEEDBACK,
|
|
40
50
|
PERMISSIONS.SUBMIT_ON_BEHALF,
|
package/lib/auth/session.ts
CHANGED
package/lib/db/index.ts
CHANGED
package/lib/db/migrate.test.ts
CHANGED
package/lib/db/migrate.ts
CHANGED
package/lib/db/schema/auth.ts
CHANGED
package/lib/db/schema/index.ts
CHANGED
package/lib/db/schema/tags.ts
CHANGED
package/lib/db/schema/votes.ts
CHANGED
package/lib/feedback/filters.ts
CHANGED
package/lib/feedback/prefill.ts
CHANGED
package/lib/invitations.ts
CHANGED
package/lib/logger.test.ts
CHANGED
package/lib/logger.ts
CHANGED
package/lib/middleware/rbac.ts
CHANGED
package/lib/portal/analytics.ts
CHANGED
package/lib/portal/i18n.ts
CHANGED
package/lib/portal/modules.ts
CHANGED
package/lib/portal/seo.ts
CHANGED