[PR #1277] [MERGED] feat!: rename right to permission #1391

Closed
opened 2025-11-01 21:17:31 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/go-vikunja/vikunja/pull/1277
Author: @kolaente
Created: 8/12/2025
Status: Merged
Merged: 8/13/2025
Merged by: @kolaente

Base: mainHead: feat/replace-rights-permission


📝 Commits (3)

  • 8558a26 feat!: rename right to permission
  • 6964618 fix: make sure api permissions use correct table name
  • db3e2ef feat: add migration to rename rights columns

📊 Changes

130 files changed (+872 additions, -752 deletions)

View changed files

📝 .golangci.yml (+1 -1)
📝 AGENTS.md (+8 -8)
📝 frontend/cypress/e2e/project/project-view-list.spec.ts (+1 -1)
📝 frontend/cypress/e2e/sharing/linkShare.spec.ts (+1 -1)
📝 frontend/cypress/factories/link_sharing.ts (+1 -1)
📝 frontend/cypress/factories/users_project.ts (+1 -1)
📝 frontend/src/components/home/AppHeader.vue (+2 -2)
📝 frontend/src/components/home/ProjectsNavigationItem.vue (+4 -4)
📝 frontend/src/components/project/ProjectSettingsDropdown.vue (+2 -2)
📝 frontend/src/components/project/ProjectWrapper.vue (+1 -1)
📝 frontend/src/components/project/views/ProjectGantt.vue (+2 -2)
📝 frontend/src/components/project/views/ProjectKanban.vue (+2 -2)
📝 frontend/src/components/project/views/ProjectList.vue (+2 -2)
📝 frontend/src/components/sharing/LinkSharing.vue (+17 -17)
📝 frontend/src/components/sharing/UserTeam.vue (+27 -27)
frontend/src/constants/permissions.ts (+7 -0)
frontend/src/constants/rights.ts (+0 -7)
📝 frontend/src/modelTypes/IAbstract.ts (+2 -2)
📝 frontend/src/modelTypes/ILinkShare.ts (+2 -2)
📝 frontend/src/modelTypes/ITeam.ts (+2 -2)

...and 80 more files

📄 Description

  • Needs a migration to rename database columns from right to permission
I've used this bash script to rename everything (curtosy of claude), click to expand
#!/usr/bin/env bash

# Script to replace "right/rights" with "permission/permissions" across the Vikunja codebase
# Preserves case and handles both filenames and file contents
# Excludes words like "Copyright" to avoid false positives

set -e

echo "Starting replacement of 'right/rights' with 'permission/permissions'..."

# Phase 1: Rename files containing "right" or "rights" in their names
echo "Phase 1: Renaming files..."

# Find files with "right" or "rights" in their names (case-insensitive)
# Exclude translation files (except en.json), LICENSE, CHANGELOG.md, and go.mod
git ls-files | grep -E 'right[s]?' | grep -vE '(frontend/src/i18n/lang/|pkg/i18n/lang/)[^/]*\.json$' | grep -E '(en\.json$|[^/]*\.(go|ts|vue|js|md|yml|yaml|sh)$)' | grep -vE '(LICENSE|CHANGELOG\.md|go\.mod)$' | while IFS= read -r file; do
    if [[ -e "$file" ]]; then
        # Get directory and filename
        dir=$(dirname "$file")
        filename=$(basename "$file")
        
        # Replace various cases in filename (simple replacement since filenames don't have copyright text)
        new_filename="$filename"
        new_filename=$(echo "$new_filename" | sed 's/rights/permissions/g')
        new_filename=$(echo "$new_filename" | sed 's/Rights/Permissions/g')
        new_filename=$(echo "$new_filename" | sed 's/RIGHTS/PERMISSIONS/g')
        new_filename=$(echo "$new_filename" | sed 's/right/permission/g')
        new_filename=$(echo "$new_filename" | sed 's/Right/Permission/g')
        new_filename=$(echo "$new_filename" | sed 's/RIGHT/PERMISSION/g')
        
        # Only rename if the filename actually changed
        if [[ "$filename" != "$new_filename" ]]; then
            new_path="$dir/$new_filename"
            echo "Renaming: $file -> $new_path"
            git mv "$file" "$new_path"
        fi
    fi
done

echo "Phase 1 complete: File renaming finished."

# Phase 2: Replace content in all git-tracked files
echo "Phase 2: Replacing content in files..."

# Get all git-tracked files (excluding directories and excluded files)
# Exclude translation files (except en.json), LICENSE, CHANGELOG.md, and go.mod
git ls-files | grep -vE '(frontend/src/i18n/lang/|pkg/i18n/lang/)[^/]*\.json$' | grep -E '(en\.json$|[^/]*\.(go|ts|vue|js|md|yml|yaml|sh|txt|json)$)' | grep -vE '(LICENSE|CHANGELOG\.md|go\.mod)$' | while IFS= read -r file; do
    if [[ -f "$file" ]]; then
        # Skip binary files by checking if file contains null bytes
        if file "$file" | grep -q "text\|empty"; then
            # Create a temporary file for sed operations
            temp_file=$(mktemp)
            
            # Apply all replacements with word boundaries to avoid "Copyright" etc.
            # Specifically exclude "All rights reserved" pattern
            # Order matters: do plurals first to avoid double-replacement
            sed -e '/All rights reserved/!s/\brights\b/permissions/g' \
                -e '/All rights reserved/!s/\bRights\b/Permissions/g' \
                -e '/All rights reserved/!s/\bRIGHTS\b/PERMISSIONS/g' \
                -e '/All rights reserved/!s/\bright\b/permission/g' \
                -e '/All rights reserved/!s/\bRight\b/Permission/g' \
                -e '/All rights reserved/!s/\bRIGHT\b/PERMISSION/g' \
                "$file" > "$temp_file"
            
            # Check if file actually changed
            if ! cmp -s "$file" "$temp_file"; then
                echo "Processing: $file"
                mv "$temp_file" "$file"
            else
                rm "$temp_file"
            fi
        fi
    fi
done

echo "Phase 2 complete: Content replacement finished."
echo ""
echo "Replacement complete! Summary:"
echo "- Renamed files containing 'right/rights' in their names"
echo "- Replaced all occurrences of:"
echo "  * right -> permission"
echo "  * Right -> Permission" 
echo "  * RIGHT -> PERMISSION"
echo "  * rights -> permissions"
echo "  * Rights -> Permissions"
echo "  * RIGHTS -> PERMISSIONS"
echo "- Preserved copyright headers with 'All rights reserved' and words like 'Copyright'"
echo "- Processed only git-tracked files (respects .gitignore)"
echo "- Excluded translation files (except en.json), LICENSE, CHANGELOG.md, and go.mod"
echo ""
echo "Run 'git status' to see all changes made."

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/go-vikunja/vikunja/pull/1277 **Author:** [@kolaente](https://github.com/kolaente) **Created:** 8/12/2025 **Status:** ✅ Merged **Merged:** 8/13/2025 **Merged by:** [@kolaente](https://github.com/kolaente) **Base:** `main` ← **Head:** `feat/replace-rights-permission` --- ### 📝 Commits (3) - [`8558a26`](https://github.com/go-vikunja/vikunja/commit/8558a269aee8c647644047673f890d9038d9e868) feat!: rename right to permission - [`6964618`](https://github.com/go-vikunja/vikunja/commit/6964618f0cec0bcb6d8f22e44347e76a9df6231c) fix: make sure api permissions use correct table name - [`db3e2ef`](https://github.com/go-vikunja/vikunja/commit/db3e2effa241fd069e873b8ff9612535a793e2a8) feat: add migration to rename rights columns ### 📊 Changes **130 files changed** (+872 additions, -752 deletions) <details> <summary>View changed files</summary> 📝 `.golangci.yml` (+1 -1) 📝 `AGENTS.md` (+8 -8) 📝 `frontend/cypress/e2e/project/project-view-list.spec.ts` (+1 -1) 📝 `frontend/cypress/e2e/sharing/linkShare.spec.ts` (+1 -1) 📝 `frontend/cypress/factories/link_sharing.ts` (+1 -1) 📝 `frontend/cypress/factories/users_project.ts` (+1 -1) 📝 `frontend/src/components/home/AppHeader.vue` (+2 -2) 📝 `frontend/src/components/home/ProjectsNavigationItem.vue` (+4 -4) 📝 `frontend/src/components/project/ProjectSettingsDropdown.vue` (+2 -2) 📝 `frontend/src/components/project/ProjectWrapper.vue` (+1 -1) 📝 `frontend/src/components/project/views/ProjectGantt.vue` (+2 -2) 📝 `frontend/src/components/project/views/ProjectKanban.vue` (+2 -2) 📝 `frontend/src/components/project/views/ProjectList.vue` (+2 -2) 📝 `frontend/src/components/sharing/LinkSharing.vue` (+17 -17) 📝 `frontend/src/components/sharing/UserTeam.vue` (+27 -27) ➕ `frontend/src/constants/permissions.ts` (+7 -0) ➖ `frontend/src/constants/rights.ts` (+0 -7) 📝 `frontend/src/modelTypes/IAbstract.ts` (+2 -2) 📝 `frontend/src/modelTypes/ILinkShare.ts` (+2 -2) 📝 `frontend/src/modelTypes/ITeam.ts` (+2 -2) _...and 80 more files_ </details> ### 📄 Description - [x] Needs a migration to rename database columns from `right` to `permission` <details> <summary>I've used this bash script to rename everything (curtosy of claude), click to expand</summary> ```bash #!/usr/bin/env bash # Script to replace "right/rights" with "permission/permissions" across the Vikunja codebase # Preserves case and handles both filenames and file contents # Excludes words like "Copyright" to avoid false positives set -e echo "Starting replacement of 'right/rights' with 'permission/permissions'..." # Phase 1: Rename files containing "right" or "rights" in their names echo "Phase 1: Renaming files..." # Find files with "right" or "rights" in their names (case-insensitive) # Exclude translation files (except en.json), LICENSE, CHANGELOG.md, and go.mod git ls-files | grep -E 'right[s]?' | grep -vE '(frontend/src/i18n/lang/|pkg/i18n/lang/)[^/]*\.json$' | grep -E '(en\.json$|[^/]*\.(go|ts|vue|js|md|yml|yaml|sh)$)' | grep -vE '(LICENSE|CHANGELOG\.md|go\.mod)$' | while IFS= read -r file; do if [[ -e "$file" ]]; then # Get directory and filename dir=$(dirname "$file") filename=$(basename "$file") # Replace various cases in filename (simple replacement since filenames don't have copyright text) new_filename="$filename" new_filename=$(echo "$new_filename" | sed 's/rights/permissions/g') new_filename=$(echo "$new_filename" | sed 's/Rights/Permissions/g') new_filename=$(echo "$new_filename" | sed 's/RIGHTS/PERMISSIONS/g') new_filename=$(echo "$new_filename" | sed 's/right/permission/g') new_filename=$(echo "$new_filename" | sed 's/Right/Permission/g') new_filename=$(echo "$new_filename" | sed 's/RIGHT/PERMISSION/g') # Only rename if the filename actually changed if [[ "$filename" != "$new_filename" ]]; then new_path="$dir/$new_filename" echo "Renaming: $file -> $new_path" git mv "$file" "$new_path" fi fi done echo "Phase 1 complete: File renaming finished." # Phase 2: Replace content in all git-tracked files echo "Phase 2: Replacing content in files..." # Get all git-tracked files (excluding directories and excluded files) # Exclude translation files (except en.json), LICENSE, CHANGELOG.md, and go.mod git ls-files | grep -vE '(frontend/src/i18n/lang/|pkg/i18n/lang/)[^/]*\.json$' | grep -E '(en\.json$|[^/]*\.(go|ts|vue|js|md|yml|yaml|sh|txt|json)$)' | grep -vE '(LICENSE|CHANGELOG\.md|go\.mod)$' | while IFS= read -r file; do if [[ -f "$file" ]]; then # Skip binary files by checking if file contains null bytes if file "$file" | grep -q "text\|empty"; then # Create a temporary file for sed operations temp_file=$(mktemp) # Apply all replacements with word boundaries to avoid "Copyright" etc. # Specifically exclude "All rights reserved" pattern # Order matters: do plurals first to avoid double-replacement sed -e '/All rights reserved/!s/\brights\b/permissions/g' \ -e '/All rights reserved/!s/\bRights\b/Permissions/g' \ -e '/All rights reserved/!s/\bRIGHTS\b/PERMISSIONS/g' \ -e '/All rights reserved/!s/\bright\b/permission/g' \ -e '/All rights reserved/!s/\bRight\b/Permission/g' \ -e '/All rights reserved/!s/\bRIGHT\b/PERMISSION/g' \ "$file" > "$temp_file" # Check if file actually changed if ! cmp -s "$file" "$temp_file"; then echo "Processing: $file" mv "$temp_file" "$file" else rm "$temp_file" fi fi fi done echo "Phase 2 complete: Content replacement finished." echo "" echo "Replacement complete! Summary:" echo "- Renamed files containing 'right/rights' in their names" echo "- Replaced all occurrences of:" echo " * right -> permission" echo " * Right -> Permission" echo " * RIGHT -> PERMISSION" echo " * rights -> permissions" echo " * Rights -> Permissions" echo " * RIGHTS -> PERMISSIONS" echo "- Preserved copyright headers with 'All rights reserved' and words like 'Copyright'" echo "- Processed only git-tracked files (respects .gitignore)" echo "- Excluded translation files (except en.json), LICENSE, CHANGELOG.md, and go.mod" echo "" echo "Run 'git status' to see all changes made." ``` </details> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2025-11-01 21:17:31 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/vikunja#1391