[server][core] Fix fullResourceQuery for root node

This commit is contained in:
Abhishek Shroff
2025-05-13 03:53:49 +05:30
parent 8ea3d01db8
commit 2e405de4e1
2 changed files with 2 additions and 2 deletions

View File

@@ -75,7 +75,7 @@ func setupUserAddCommand() *cobra.Command {
var u user.User
var home fs.Resource
if homePath != "" {
f = common.RootFileSystem().WithDb(db)
f = f.WithDb(db)
var err error
home, err = f.CreateResourceByPath(homePath, uuid.Nil, true, true, fs.ResourceBindConflictResolutionEnsure)
if err != nil {

View File

@@ -22,7 +22,7 @@ const fullResourceQuery = `SELECT r.*,
(SELECT ` + publinkFieldsQuery + ` FROM publinks l WHERE l.root = r.id) AS links,
CASE WHEN COALESCE(p.permissions[@username::TEXT]::INTEGER, 0) <> 0 THEN p.id ELSE NULL END AS visible_parent,
COALESCE(p.permissions, '{}'::JSONB) AS inherited_permissions
FROM resources r JOIN resources p ON p.id = r.parent
FROM resources r LEFT JOIN resources p ON p.id = r.parent
`
func selectResourceTree(id uuid.UUID, excludeTreeRoot, includeDeleted, includeLinks bool, extraCols ...string) (exp.IdentifierExpression, exp.AliasedExpression, *goqu.SelectDataset) {