Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

Anty0
Copy link
Collaborator

@Anty0 Anty0 commented Apr 25, 2025

Supersedes #3016

Summary by CodeRabbit

  • New Features

    • Introduced a new organization role: "MAINTAINER," which can now create projects and is recognized throughout the app and API.
    • Added support for displaying and translating the "MAINTAINER" role in the user interface.
    • Expanded error messages and API responses to include cases for users who are not owners or maintainers.
    • Added a search parameter for namespace listing and a new timestamp field for language statistics.
  • Bug Fixes

    • Adjusted permission checks to ensure maintainers have appropriate access to create projects and manage permissions.
    • Refined role membership checks to distinguish members from owners and maintainers where applicable.
  • Tests

    • Added and updated tests to verify project creation and permission logic for maintainers.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Apr 25, 2025

Walkthrough

The changes introduce a new organization role, "MAINTAINER," and expand role-based access control throughout the backend and frontend. Backend logic now distinguishes between OWNER, MAINTAINER, and MEMBER roles, updating permission checks, role assignments, and error handling accordingly. The API schema and frontend code are updated to recognize and display the new MAINTAINER role, including translations and UI conditions. Tests are added and adjusted to verify the new role's behavior. The changes also refine member checks, separating owner and member logic, and add a new error code for insufficient organization role permissions.

Changes

File(s) / Path(s) Change Summary
backend/data/src/main/kotlin/io/tolgee/model/enums/OrganizationRoleType.kt
webapp/src/service/response.types.ts
Added the MAINTAINER role to the organization role enums in both backend and frontend.
backend/data/src/main/kotlin/io/tolgee/service/organization/OrganizationRoleService.kt Refactored to explicitly support the MAINTAINER role. Added methods for checking owner or maintainer roles, granting maintainer role, and updated role validation logic. Removed or replaced previous member-or-owner conflations with more precise role checks.
backend/api/src/main/kotlin/io/tolgee/api/v2/controllers/project/ProjectsController.kt Updated project creation logic to allow both owners and maintainers to create projects. Grants full project permissions to maintainers upon creation.
backend/data/src/main/kotlin/io/tolgee/constants/Message.kt Added new enum constant USER_IS_NOT_OWNER_OR_MAINTAINER_OF_ORGANIZATION.
backend/data/src/main/kotlin/io/tolgee/service/security/PermissionService.kt Updated permission computation to include MAINTAINER alongside MEMBER for organization base permissions. Changed permission removal logic to use member-only checks.
backend/data/src/main/kotlin/io/tolgee/service/invitation/InvitationService.kt
backend/app/src/test/kotlin/io/tolgee/api/v2/controllers/organizationController/OrganizationControllerInvitingTest.kt
backend/data/src/main/kotlin/io/tolgee/security/thirdParty/ThirdPartyUserHandler.kt
backend/data/src/main/kotlin/io/tolgee/service/security/AuthProviderChangeService.kt
Changed organization role checks from member-or-owner to member-only in invitation acceptance, tests, and user management logic.
backend/app/src/test/kotlin/io/tolgee/api/v2/controllers/v2ProjectsController/ProjectsControllerCreateTest.kt Added tests verifying that maintainers can create projects in organizations and that maintainers cannot delete projects.
webapp/src/service/apiSchema.generated.ts Updated API schema: added MAINTAINER to role enums, new error code for insufficient owner/maintainer permission, clarified documentation, and added a new field and query parameter.
webapp/src/translationTools/useOrgRoleTranslation.ts Added translation support for the MAINTAINER role in organization role translations.
webapp/src/views/projects/ProjectListView.tsx Broadened UI permission checks to include both OWNER and MAINTAINER roles for project creation and related UI elements.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant API
    participant ProjectsController
    participant OrganizationRoleService
    participant ProjectService

    User->>API: Create Project Request (with organizationId)
    API->>ProjectsController: createProject(dto)
    ProjectsController->>OrganizationRoleService: checkUserIsOwnerOrMaintainer(organizationId)
    alt User is OWNER or MAINTAINER
        ProjectsController->>ProjectService: createProject(dto)
        ProjectService-->>ProjectsController: ProjectModel
        alt User is MAINTAINER
            ProjectsController->>ProjectService: grantFullAccessToUser(user, project)
        end
        ProjectsController-->>API: ProjectModel
    else User is not OWNER or MAINTAINER
        ProjectsController-->>API: Error(USER_IS_NOT_OWNER_OR_MAINTAINER_OF_ORGANIZATION)
    end
Loading

Poem

In burrows deep, a change was made,
Now maintainers join the owner parade!
With paws and whiskers, projects grow,
Permissions checked before we go.
MAINTAINER hops into the role array,
More bunnies building, hooray, hooray!
🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 99371d0 and 91c3aa8.

📒 Files selected for processing (5)
  • backend/app/src/test/kotlin/io/tolgee/api/v2/controllers/organizationController/OrganizationControllerInvitingTest.kt (1 hunks)
  • backend/data/src/main/kotlin/io/tolgee/security/thirdParty/ThirdPartyUserHandler.kt (1 hunks)
  • backend/data/src/main/kotlin/io/tolgee/service/invitation/InvitationService.kt (1 hunks)
  • backend/data/src/main/kotlin/io/tolgee/service/organization/OrganizationRoleService.kt (6 hunks)
  • backend/data/src/main/kotlin/io/tolgee/service/security/AuthProviderChangeService.kt (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (5)
  • backend/app/src/test/kotlin/io/tolgee/api/v2/controllers/organizationController/OrganizationControllerInvitingTest.kt
  • backend/data/src/main/kotlin/io/tolgee/security/thirdParty/ThirdPartyUserHandler.kt
  • backend/data/src/main/kotlin/io/tolgee/service/security/AuthProviderChangeService.kt
  • backend/data/src/main/kotlin/io/tolgee/service/invitation/InvitationService.kt
  • backend/data/src/main/kotlin/io/tolgee/service/organization/OrganizationRoleService.kt
⏰ Context from checks skipped due to timeout of 90000ms (22)
  • GitHub Check: E2E testing ‍🔎 (15, 14)
  • GitHub Check: E2E testing ‍🔎 (15, 13)
  • GitHub Check: E2E testing ‍🔎 (15, 12)
  • GitHub Check: E2E testing ‍🔎 (15, 11)
  • GitHub Check: E2E testing ‍🔎 (15, 10)
  • GitHub Check: E2E testing ‍🔎 (15, 9)
  • GitHub Check: E2E testing ‍🔎 (15, 8)
  • GitHub Check: E2E testing ‍🔎 (15, 7)
  • GitHub Check: BT ‍🔎 (security:test)
  • GitHub Check: E2E testing ‍🔎 (15, 6)
  • GitHub Check: BT ‍🔎 (data:test)
  • GitHub Check: E2E testing ‍🔎 (15, 5)
  • GitHub Check: BT ‍🔎 (ee-test:test)
  • GitHub Check: E2E testing ‍🔎 (15, 4)
  • GitHub Check: BT ‍🔎 (server-app:runWithoutEeTests)
  • GitHub Check: E2E testing ‍🔎 (15, 3)
  • GitHub Check: BT ‍🔎 (server-app:runWebsocketTests)
  • GitHub Check: E2E testing ‍🔎 (15, 2)
  • GitHub Check: BT ‍🔎 (server-app:runStandardTests)
  • GitHub Check: E2E testing ‍🔎 (15, 1)
  • GitHub Check: BT ‍🔎 (server-app:runContextRecreatingTests)
  • GitHub Check: E2E testing ‍🔎 (15, 0)
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@Anty0 Anty0 changed the title feat: Add maintainer organization permission feat: Add maintainer organization role Apr 25, 2025
@Anty0 Anty0 marked this pull request as ready for review April 28, 2025 15:15
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🔭 Outside diff range comments (1)
webapp/src/translationTools/useOrgRoleTranslation.ts (1)

1-30: 💡 Verification agent

🧩 Analysis chain

Verify translation key existence in translation files

The code correctly adds translation handling for the new MAINTAINER role, but we should ensure the new translation keys exist in all language files.


🏁 Script executed:

#!/bin/bash
# Check if translation keys for MAINTAINER role exist in translation files

# Find all translation JSON files
echo "Searching for translation files..."
translation_files=$(find . -path "*/public/i18n/*.json" -type f)

if [ -z "$translation_files" ]; then
  echo "No translation files found in expected locations"
  # Try alternative locations
  translation_files=$(find . -name "*.json" | grep -i "i18n\|translations\|locale")
fi

echo "Found translation files:"
echo "$translation_files"

echo -e "\nChecking for MAINTAINER role translation keys..."
for file in $translation_files; do
  echo "Checking file: $file"
  
  # Check for the regular translation key
  if grep -q "organization_role_type_MAINTAINER" "$file"; then
    echo "✓ organization_role_type_MAINTAINER found"
  else
    echo "✗ organization_role_type_MAINTAINER NOT found"
  fi
  
  # Check for the hint translation key
  if grep -q "organization_role_type_MAINTAINER_hint" "$file"; then
    echo "✓ organization_role_type_MAINTAINER_hint found"
  else
    echo "✗ organization_role_type_MAINTAINER_hint NOT found"
  fi
  
  echo ""
done

Length of output: 14211


Add missing MAINTAINER translation keys

The new MAINTAINER role keys aren’t present in any of our locales. Please add both entries to every translation file:

• webapp/src/i18n/.json
• backend/data/src/test/resources/import/i18next/
.json

For example, in webapp/src/i18n/en.json:

{
  …,
  "organization_role_type_MEMBER": "Member",
  "organization_role_type_MEMBER_hint": "Member can view resources",
  "organization_role_type_OWNER": "Owner",
  "organization_role_type_OWNER_hint": "Owner can manage settings",
  "organization_role_type_MAINTAINER": "Maintainer",
  "organization_role_type_MAINTAINER_hint": "Maintainer can manage workflows"
}

Repeat and provide appropriate translations in each locale file.

🧹 Nitpick comments (6)
backend/app/src/test/kotlin/io/tolgee/api/v2/controllers/organizationController/OrganizationControllerInvitingTest.kt (1)

1-222: Consider adding tests for the new MAINTAINER role

The test has been updated for the existing role check changes, but there are no tests specifically verifying the behavior of the new MAINTAINER role. Consider adding test cases for inviting users as MAINTAINERS and verifying their permissions.

You could add a test similar to testAcceptInvitation but for the MAINTAINER role:

@Test
fun testAcceptMaintainerInvitation() {
  val helloUser = dbPopulator.createUserIfNotExists("hellouser")

  this.organizationService.create(dummyDto, helloUser).let { organization ->
    val invitation =
      invitationService.create(
        CreateOrganizationInvitationParams(
          organization = organization,
          type = OrganizationRoleType.MAINTAINER,
        ),
      )
    val invitedUser = dbPopulator.createUserIfNotExists("invitedMaintainer")
    loginAsUser(invitedUser.username)
    performAuthGet("/v2/invitations/${invitation.code}/accept").andIsOk
    
    // Verify the user is a maintainer
    val isMaintainer = organizationRoleService.isUserMaintainer(invitedUser.id, organization.id)
    assertThat(isMaintainer).isTrue
    
    // Verify the user is not an owner
    val isOwner = organizationRoleService.isUserOwner(invitedUser.id, organization.id)
    assertThat(isOwner).isFalse
  }
}
backend/api/src/main/kotlin/io/tolgee/api/v2/controllers/project/ProjectsController.kt (1)

100-102: Grant explicit permissions to maintainers creating projects.

This conditional block grants full access permissions to maintainers who create projects. This is necessary because unlike owners who inherently have full access to all projects in their organization, maintainers need explicit permission grants.

I recommend adding a comment explaining why this conditional grant is needed for maintainers but not for owners, to clarify the permission model for future developers.

 if (organizationRoleService.getType(dto.organizationId) == OrganizationRoleType.MAINTAINER) {
+  // Unlike owners who inherently have full access to all projects, maintainers need explicit permissions
   permissionService.grantFullAccessToProject(authenticationFacade.authenticatedUserEntity, project)
 }
backend/data/src/main/kotlin/io/tolgee/service/organization/OrganizationRoleService.kt (4)

103-112: Clarify MAINTAINER rank semantics in KDoc / javadoc
isUserOfRole now treats MAINTAINER as inclusive of OWNER (i.e. owners satisfy a MAINTAINER-level check). That seems intentional (“equal or higher than a given role”), but is not obvious at call-sites. Please add a short comment to the MAINTAINER branch (or to the method header) to make this precedence explicit and prevent future misuse.


131-145: Avoid copy-pasted owner/maintainer check logic
checkUserIsOwnerOrMaintainer duplicates most of the logic already present in checkUserIsOwner (server-admin bypass, role evaluation, exception throwing). A tiny util that takes “roles allowed” + “exception message” would keep both code paths DRY and reduce the risk of future divergence.

-private fun doRoleCheck(
-  userId: Long,
-  requiredRoles: Set<OrganizationRoleType>,
-  exception: Message
-) {
-  val isServerAdmin = userAccountService.getDto(userId).role == UserAccount.Role.ADMIN
-  if (!isServerAdmin && !requiredRoles.contains(self.getDto(orgId, userId).type)) {
-    throw PermissionException(exception)
-  }
-}

… and reuse it from both public helpers.


182-188: Minor: use EnumSet for role collections
OWNER_OR_MAINTAINER_ROLES is looked-up on every call; using EnumSet.of(...) is a tiny optimisation (backed by bit-vector) and self-documents intent that the set is immutable.

-private val OWNER_OR_MAINTAINER_ROLES = setOf(
-  OrganizationRoleType.OWNER, 
-  OrganizationRoleType.MAINTAINER
-)
+private val OWNER_OR_MAINTAINER_ROLES: Set<OrganizationRoleType> =
+  EnumSet.of(OrganizationRoleType.OWNER, OrganizationRoleType.MAINTAINER)

299-304: Add unit test for grantMaintainerRoleToUser workflow
The new helper mirrors the existing member/owner helpers, but there is no guard-rail test ensuring the side-effects (cache eviction, managed-user validation, etc.). Consider adding a happy-path + validation-failure test similar to those for owners to prevent regressions.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0a064d5 and 4fc2a41.

📒 Files selected for processing (14)
  • backend/api/src/main/kotlin/io/tolgee/api/v2/controllers/project/ProjectsController.kt (2 hunks)
  • backend/app/src/test/kotlin/io/tolgee/api/v2/controllers/organizationController/OrganizationControllerInvitingTest.kt (1 hunks)
  • backend/app/src/test/kotlin/io/tolgee/api/v2/controllers/v2ProjectsController/ProjectsControllerCreateTest.kt (2 hunks)
  • backend/data/src/main/kotlin/io/tolgee/constants/Message.kt (1 hunks)
  • backend/data/src/main/kotlin/io/tolgee/model/enums/OrganizationRoleType.kt (1 hunks)
  • backend/data/src/main/kotlin/io/tolgee/security/thirdParty/ThirdPartyUserHandler.kt (1 hunks)
  • backend/data/src/main/kotlin/io/tolgee/service/invitation/InvitationService.kt (2 hunks)
  • backend/data/src/main/kotlin/io/tolgee/service/organization/OrganizationRoleService.kt (5 hunks)
  • backend/data/src/main/kotlin/io/tolgee/service/security/AuthProviderChangeService.kt (1 hunks)
  • backend/data/src/main/kotlin/io/tolgee/service/security/PermissionService.kt (2 hunks)
  • webapp/src/service/apiSchema.generated.ts (16 hunks)
  • webapp/src/service/response.types.ts (1 hunks)
  • webapp/src/translationTools/useOrgRoleTranslation.ts (1 hunks)
  • webapp/src/views/projects/ProjectListView.tsx (2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
webapp/src/views/projects/ProjectListView.tsx (1)
webapp/src/globalContext/helpers.tsx (1)
  • useIsAdmin (21-22)
🔇 Additional comments (24)
backend/data/src/main/kotlin/io/tolgee/model/enums/OrganizationRoleType.kt (1)

6-6: Implementation of the new MAINTAINER role looks good

The MAINTAINER role has been properly added to the OrganizationRoleType enum, positioned between MEMBER and OWNER which reflects its intended permission hierarchy.

webapp/src/service/response.types.ts (1)

51-51: Frontend implementation of MAINTAINER role looks good

The MAINTAINER role has been correctly added to the OrganizationRoleType enum in the frontend code, maintaining consistency with the backend implementation.

backend/data/src/main/kotlin/io/tolgee/constants/Message.kt (1)

216-216: New error message for insufficient role permissions

The added error message constant USER_IS_NOT_OWNER_OR_MAINTAINER_OF_ORGANIZATION provides appropriate feedback when a user attempts an operation that requires either owner or maintainer privileges.

backend/data/src/main/kotlin/io/tolgee/security/thirdParty/ThirdPartyUserHandler.kt (1)

82-82: Refined role check in third-party user handling

The change from isUserMemberOrOwner to isUserMember appropriately refines the role checking logic to align with the new role structure. This ensures a clearer separation of concerns where member status is checked independently of higher-level roles like maintainer or owner.

backend/data/src/main/kotlin/io/tolgee/service/invitation/InvitationService.kt (2)

28-29: Good imports refactoring

The explicit imports for Date and Optional classes are cleaner than using a wildcard import.


173-173: Check for membership role refined

Changed from checking if user is a member or owner to checking if user is specifically a member. This aligns with the new MAINTAINER role introduction and provides clearer role distinction.

backend/data/src/main/kotlin/io/tolgee/service/security/AuthProviderChangeService.kt (1)

254-254: Check for membership role refined

Changed from checking if user is a member or owner to checking if user is specifically a member. This change is consistent with the new role system that differentiates between MEMBER, MAINTAINER, and OWNER roles.

webapp/src/translationTools/useOrgRoleTranslation.ts (2)

14-15: Support added for MAINTAINER role hint translation

Added case for the new MAINTAINER role to return the appropriate hint translation key.


23-24: Support added for MAINTAINER role translation

Added case for the new MAINTAINER role to return the appropriate translation key.

backend/app/src/test/kotlin/io/tolgee/api/v2/controllers/organizationController/OrganizationControllerInvitingTest.kt (1)

102-102: Updated test to match service implementation

Test has been updated to verify only membership using isUserMember instead of checking for member or owner status. This aligns with the service implementation changes and the new role system.

backend/api/src/main/kotlin/io/tolgee/api/v2/controllers/project/ProjectsController.kt (2)

25-25: Added required import for OrganizationRoleType.

The import is necessary to support the newly introduced role check logic for maintainers in the createProject method.


98-98: Updated role check to allow maintainers to create projects.

The method call has been updated from checkUserIsOwner to checkUserIsOwnerOrMaintainer, expanding project creation permissions to maintainers in addition to owners.

backend/app/src/test/kotlin/io/tolgee/api/v2/controllers/v2ProjectsController/ProjectsControllerCreateTest.kt (2)

8-8: Added required import for OrganizationRoleType.

This import is necessary for the new test case that verifies project creation by maintainers.


109-126: Added test to verify project creation by maintainers.

This test ensures that users with the MAINTAINER role can create projects in an organization, which is a key part of the new maintainer role functionality. The test properly:

  1. Creates a test organization and user
  2. Assigns the MAINTAINER role to the user
  3. Attempts to create a project as that maintainer
  4. Verifies the project is created successfully with the correct organization

This provides good coverage for the new feature.

webapp/src/views/projects/ProjectListView.tsx (3)

52-54: Expanded role check to include maintainers.

Renamed isOrganizationOwner to isOrganizationOwnerOrMaintainer and updated the logic to check for both 'OWNER' and 'MAINTAINER' roles. This change aligns with the backend permission changes to allow maintainers to create projects.


60-60: Updated add button visibility for maintainers.

The addAllowed flag now uses the expanded isOrganizationOwnerOrMaintainer check to determine if the add project button should be shown, allowing maintainers to see this option.


102-102: Updated empty state action for maintainers.

The empty state now shows the "add project" button for maintainers in addition to owners, completing the UI updates needed for the new maintainer role.

backend/data/src/main/kotlin/io/tolgee/service/security/PermissionService.kt (2)

228-229: Extended permission computation to include maintainers.

Updated the condition to include organizationRole == OrganizationRoleType.MAINTAINER alongside MEMBER when determining organization base permissions. This ensures maintainers receive the appropriate base permissions in projects within their organization.


478-478:

❌ Incorrect review comment

Restricted organization base permission setting to members only.

The method call changed from what was likely checkUserIsOwnerOrMember to checkUserIsMember, restricting who can set organization base permissions to only members, not owners or maintainers.

This change appears to narrow the permission check, which might be intentional but should be verified. Let's check if this is consistent with other similar permission checks in the codebase:


🏁 Script executed:

#!/bin/bash
# Search for other usages of checkUserIsMember and compare with previous pattern
rg -A 2 -B 2 "checkUserIsMember\(" --type kotlin

Length of output: 1204


🏁 Script executed:

#!/bin/bash
# Display the implementation of checkUserIsMember to verify its behavior
rg -A 20 "fun checkUserIsMember" --type kotlin

Length of output: 2403


No restriction change – checkUserIsMember still allows owners and maintainers

The checkUserIsMember implementation treats any non-null role (including OWNER, MAINTAINER, etc.) as membership and also permits server admins. Therefore swapping from a hypothetical checkUserIsOwnerOrMember to checkUserIsMember does not exclude owners or maintainers.

• In OrganizationRoleService.kt, checkUserIsMember returns if isUserMember(userId, orgId) is true, and isUserMember simply checks for any role (type != null).
• Server admins are still allowed via the isServerAdmin branch.

You can safely ignore the concern about owners being excluded here.

Likely an incorrect or invalid review comment.

webapp/src/service/apiSchema.generated.ts (5)

1340-1340: Documentation enhancement clarifies XLIFF-only escapeHtml feature

The documentation clarification that HTML escaping is supported only in XLIFF format provides important usage details for developers. This is a good improvement to prevent incorrect expectations when using other export formats.

Also applies to: 1458-1458, 2093-2093, 10860-10860


1994-1994: New error code supports the MAINTAINER role permission checks

The addition of the error code "user_is_not_owner_or_maintainer_of_organization" properly supports the new MAINTAINER role and refines permission boundaries in the API. This is consistent with the broader change to introduce role-based permission gradations.

Also applies to: 4512-4512


2917-2918: New translationsUpdatedAt field supports translation tracking

The addition of an optional timestamp field to track when translations were last updated provides valuable metadata for users. This can help with determining translation freshness and tracking localization progress.


3090-3090: MAINTAINER role added consistently across all relevant models

The "MAINTAINER" role has been consistently added to all organization role type definitions throughout the schema. This ensures the new role is properly supported in all API operations where organization roles are involved.

Also applies to: 3097-3097, 3107-3107, 3515-3515, 3713-3713, 3766-3766, 4117-4117, 4919-4919, 4938-4938


13926-13926: Search parameter added to namespace listing API

The addition of an optional search parameter to the namespace listing API enhances the API's filtering capabilities, allowing clients to search for specific namespaces.

@Anty0 Anty0 requested a review from JanCizmar April 28, 2025 15:26
return when (role) {
OrganizationRoleType.MEMBER ->
isUserMemberOrOwner(userId, organizationId)
isUserMember(userId, organizationId)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename it to hasAnyOrganizationRole

@Anty0 Anty0 enabled auto-merge (squash) April 29, 2025 16:37
@Anty0 Anty0 merged commit 2b628a0 into main Apr 30, 2025
38 checks passed
@Anty0 Anty0 deleted the jirikuchynka/add-organization-role-maintainer branch April 30, 2025 09:39
TolgeeMachine added a commit that referenced this pull request Apr 30, 2025
# [3.116.0](v3.115.0...v3.116.0) (2025-04-30)

### Features

* Add maintainer organization role ([#3043](#3043)) ([2b628a0](2b628a0)), closes [#3016](#3016)
@JanCizmar JanCizmar linked an issue May 3, 2025 that may be closed by this pull request
@coderabbitai coderabbitai bot mentioned this pull request Oct 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fine grained permission on organizations

3 participants