ultisuite-backend/internal/nextcloud/public_share_permissions.go
R3D347HR4Y 556d5f416d Enhance API and configuration for contact discovery and public sharing
- Introduced new endpoints for contact discovery, including scanning, listing, and managing discovered contacts.
- Implemented retry logic for handling missing DAV credentials during contact operations.
- Added public share functionality for drive API, allowing users to manage public shares, including upload, delete, and rename operations.
- Updated Nextcloud configuration to support public share links and improved error handling for public share permissions.
- Enhanced logging and validation across contact and drive APIs for better error tracking and user feedback.
- Added tests for new contact matching and ranking functionalities to ensure accuracy and reliability.
2026-06-06 20:27:02 +02:00

31 lines
761 B
Go

package nextcloud
import "strings"
// ParseOCPermissionLetters maps Nextcloud WebDAV oc:permissions letters to OCS bitmask.
// S=share(16), R=read(1), C=create(4), W=update(2), D=delete(8).
func ParseOCPermissionLetters(raw string) int {
raw = strings.ToUpper(strings.TrimSpace(raw))
var perms int
for _, ch := range raw {
switch ch {
case 'S':
perms |= 16
case 'R':
perms |= 1
case 'C':
perms |= 4
case 'W':
perms |= 2
case 'D':
perms |= 8
}
}
return perms
}
func PublicShareCanRead(perms int) bool { return perms&1 != 0 }
func PublicShareCanUpdate(perms int) bool { return perms&2 != 0 }
func PublicShareCanCreate(perms int) bool { return perms&4 != 0 }
func PublicShareCanDelete(perms int) bool { return perms&8 != 0 }