diff --git a/.golangci.yml b/.golangci.yml index 304e41de1..4800096d9 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -139,7 +139,7 @@ linters: text: 'G115: integer overflow conversion int -> uint64' - linters: - recvcheck - text: the methods of "Right" use pointer receiver and non-pointer receiver. + text: the methods of "Permission" use pointer receiver and non-pointer receiver. - linters: - recvcheck text: the methods of "SubscriptionEntityType" use pointer receiver and non-pointer receiver. diff --git a/AGENTS.md b/AGENTS.md index 54b4ba1ca..18025e6ce 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -73,7 +73,7 @@ The Go backend follows a layered architecture with clear separation of concerns: **Key Patterns:** - **Generic CRUD**: Models implement `CRUDable` interface for standardized database operations -- **Rights System**: Three-tier permissions (Read/Write/Admin) enforced across all operations +- **Permissions System**: Three-tier permissions (Read/Write/Admin) enforced across all operations - **Event-Driven**: Event system for notifications, webhooks, and cross-cutting concerns - **Modular Design**: Pluggable authentication, avatar providers, migration tools @@ -115,7 +115,7 @@ Modern Vue 3 composition API application with TypeScript: ### Adding New Features **Backend Changes:** -1. Create/modify models in `pkg/models/` with proper CRUD and Rights interfaces as required +1. Create/modify models in `pkg/models/` with proper CRUD and Permissions interfaces as required 2. Add database migration if needed: `mage dev:make-migration ` 3. Create/update services in `pkg/services/` for complex business logic 4. Add API routes in `pkg/routes/api/v1/` following existing patterns @@ -137,7 +137,7 @@ Modern Vue 3 composition API application with TypeScript: ### API Development - All API endpoints follow RESTful conventions under `/api/v1/` - Use generic web handlers in `pkg/web/handler/` for standard CRUD operations -- Implement proper rights checking using the Rights interface +- Implement proper permissions checking using the Permissions interface - Add Swagger annotations for automatic documentation generation ### Testing @@ -175,7 +175,7 @@ After adjusting the source string, you need to call the respective translation l - Use `pkg/config/` for configuration management **Code Style:** -- Go: golangci-lint per `.golangci.yml`; use goimports; wrap errors with `fmt.Errorf("...: %w", err)`; enforce rights checks in models; never log secrets; do not edit generated `pkg/swagger/*` +- Go: golangci-lint per `.golangci.yml`; use goimports; wrap errors with `fmt.Errorf("...: %w", err)`; enforce permissions checks in models; never log secrets; do not edit generated `pkg/swagger/*` - Vue: ESLint + TS; single quotes, trailing commas, no semicolons, tab indent; script setup + lang ts; keep services/models in sync with backend - Follow existing patterns for consistency @@ -184,16 +184,16 @@ After adjusting the source string, you need to call the respective translation l - Vue: PascalCase for components, camelCase for composables - API endpoints: kebab-case in URLs, camelCase in JSON -**Rights and Permissions:** -- Always implement Rights interface for new models +**Permissions and Permissions:** +- Always implement Permissions interface for new models - Use `CanRead`, `CanWrite`, `CanCreate`, `CanDelete` methods -- Rights are enforced at the model level, not just routes +- Permissions are enforced at the model level, not just routes ## Common Gotchas - Database migrations are irreversible in production - test thoroughly - Frontend services must match backend model structure exactly -- Rights checking is mandatory for all CRUD operations +- Permissions checking is mandatory for all CRUD operations - Event listeners in `pkg/*/listeners.go` must be registered properly - CORS settings in backend must allow frontend domain - API tokens have different scopes - check permissions carefully diff --git a/frontend/cypress/e2e/project/project-view-list.spec.ts b/frontend/cypress/e2e/project/project-view-list.spec.ts index a6414621d..482fcce98 100644 --- a/frontend/cypress/e2e/project/project-view-list.spec.ts +++ b/frontend/cypress/e2e/project/project-view-list.spec.ts @@ -59,7 +59,7 @@ describe('Project View List', () => { UserProjectFactory.create(1, { project_id: 2, user_id: 1, - right: 0, + permission: 0, }) const projects = ProjectFactory.create(2, { owner_id: '{increment}', diff --git a/frontend/cypress/e2e/sharing/linkShare.spec.ts b/frontend/cypress/e2e/sharing/linkShare.spec.ts index 37b5b8cc3..0792948f7 100644 --- a/frontend/cypress/e2e/sharing/linkShare.spec.ts +++ b/frontend/cypress/e2e/sharing/linkShare.spec.ts @@ -11,7 +11,7 @@ function prepareLinkShare() { }) const linkShares = LinkShareFactory.create(1, { project_id: projects[0].id, - right: 0, + permission: 0, }) return { diff --git a/frontend/cypress/factories/link_sharing.ts b/frontend/cypress/factories/link_sharing.ts index c420e6297..b09ddfca2 100644 --- a/frontend/cypress/factories/link_sharing.ts +++ b/frontend/cypress/factories/link_sharing.ts @@ -11,7 +11,7 @@ export class LinkShareFactory extends Factory { id: '{increment}', hash: faker.lorem.word(32), project_id: 1, - right: 0, + permission: 0, sharing_type: 0, shared_by_id: 1, created: now.toISOString(), diff --git a/frontend/cypress/factories/users_project.ts b/frontend/cypress/factories/users_project.ts index c85ed2371..b6bdde356 100644 --- a/frontend/cypress/factories/users_project.ts +++ b/frontend/cypress/factories/users_project.ts @@ -10,7 +10,7 @@ export class UserProjectFactory extends Factory { id: '{increment}', project_id: 1, user_id: 1, - right: 0, + permission: 0, created: now.toISOString(), updated: now.toISOString(), } diff --git a/frontend/src/components/home/AppHeader.vue b/frontend/src/components/home/AppHeader.vue index e5dd2aa9b..14056f3a4 100644 --- a/frontend/src/components/home/AppHeader.vue +++ b/frontend/src/components/home/AppHeader.vue @@ -116,7 +116,7 @@