Skip to content

Commit

Permalink
feat(archive): patch
Browse files Browse the repository at this point in the history
  • Loading branch information
KirCute committed Jan 16, 2025
1 parent 4bbf7a3 commit fe84d5c
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions internal/bootstrap/patch/v3_41_0/grant_permission.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,20 @@ import (
"github.com/alist-org/alist/v3/pkg/utils"
)

// GrantAdminPermissions gives admin Permission 0(can see hidden) - 9(webdav manage)
// This patch is written to help users upgrading from older version better adapt to PR AlistGo/alist#7705.
// GrantAdminPermissions gives admin Permission 0(can see hidden) - 9(webdav manage) and
// 12(can read archives) - 13(can decompress archives)
// This patch is written to help users upgrading from older version better adapt to PR AlistGo/alist#7705 and
// PR AlistGo/alist#7817.
func GrantAdminPermissions() {
admin, err := op.GetAdmin()
if err != nil {
utils.Log.Errorf("Cannot grant permissions to admin: %v", err)
}
if (admin.Permission & 0x3FF) == 0 {
admin.Permission |= 0x3FF
}
err = op.UpdateUser(admin)
if err != nil {
utils.Log.Errorf("Cannot grant permissions to admin: %v", err)
if (admin.Permission & 0x33FF) == 0 {
admin.Permission |= 0x33FF
err = op.UpdateUser(admin)
if err != nil {
utils.Log.Errorf("Cannot grant permissions to admin: %v", err)
}
}
}

0 comments on commit fe84d5c

Please sign in to comment.