test logging - FIXME
Some checks failed
build / windows (push) Has been cancelled
build / other_os (push) Has been cancelled
build / mac_amd64 (push) Has been cancelled
build / mac_arm64 (push) Has been cancelled
build / linux (push) Has been cancelled
build / go1.23 (push) Has been cancelled
build / linux_386 (push) Has been cancelled
build / lint (push) Has been cancelled
build / android-all (push) Has been cancelled
Build & Push Docker Images / Build Docker Image for linux/386 (push) Has been cancelled
Build & Push Docker Images / Build Docker Image for linux/amd64 (push) Has been cancelled
Build & Push Docker Images / Build Docker Image for linux/arm/v6 (push) Has been cancelled
Build & Push Docker Images / Build Docker Image for linux/arm/v7 (push) Has been cancelled
Build & Push Docker Images / Build Docker Image for linux/arm64 (push) Has been cancelled
Build & Push Docker Images / Merge & Push Final Docker Image (push) Has been cancelled

This commit is contained in:
Nick Craig-Wood 2025-04-08 12:32:40 +01:00
parent 961a7a49df
commit 96957a1772

View File

@ -396,6 +396,15 @@ func (m *Metadata) WritePermissions(ctx context.Context) (err error) {
return nil
}
// pprint takes an interface and logs it as human-readable JSON.
func pprint(what string, data interface{}) {
jsonData, err := json.MarshalIndent(data, "", " ") // Use 4 spaces for indentation.
if err != nil {
fs.Errorf(nil, "%s: Error marshaling JSON: %v", what, err)
}
fs.Errorf(nil, "%s:\n%s", what, string(jsonData))
}
// Order the permissions so that any with users come first.
//
// This is to work around a quirk with Graph:
@ -410,6 +419,7 @@ func (m *Metadata) WritePermissions(ctx context.Context) (err error) {
//
// See: https://github.com/rclone/rclone/issues/8465
func (m *Metadata) orderPermissions(xs []*api.PermissionsType) {
pprint("perms before sort", xs)
// Return true if identity has any user permissions
hasUserIdentity := func(identity *api.IdentitySet) bool {
if identity == nil {
@ -440,6 +450,7 @@ func (m *Metadata) orderPermissions(xs []*api.PermissionsType) {
}
return 0
})
pprint("perms after sort", xs)
}
// sortPermissions sorts the permissions (to be written) into add, update, and remove queues