1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-24 15:49:44 +02:00

Reduce cloned space permissions copy

Removed unnecessary results from SQL.
This commit is contained in:
McMatts 2018-09-10 17:40:42 +01:00
parent 9ee9526a47
commit 0847a82fc9
3 changed files with 682 additions and 677 deletions

View file

@ -117,13 +117,18 @@ func (s Scope) GetSpacePermissions(ctx domain.RequestContext, spaceID string) (r
err = s.Runtime.Db.Select(&r, `
SELECT id, orgid, who, whoid, action, scope, location, refid
FROM permission WHERE orgid=? AND location='space' AND refid=? AND who='user'
UNION ALL
SELECT p.id, p.orgid, p.who, p.whoid, p.action, p.scope, p.location, p.refid
FROM permission p
LEFT JOIN rolemember r ON p.whoid=r.roleid
WHERE p.orgid=? AND p.location='space' AND p.refid=? AND p.who='role'`,
ctx.OrgID, spaceID, ctx.OrgID, spaceID)
FROM permission WHERE orgid=? AND location='space' AND refid=?`,
ctx.OrgID, spaceID)
// err = s.Runtime.Db.Select(&r, `
// SELECT id, orgid, who, whoid, action, scope, location, refid
// FROM permission WHERE orgid=? AND location='space' AND refid=? AND who='user'
// UNION ALL
// SELECT p.id, p.orgid, p.who, p.whoid, p.action, p.scope, p.location, p.refid
// FROM permission p
// LEFT JOIN rolemember r ON p.whoid=r.roleid
// WHERE p.orgid=? AND p.location='space' AND p.refid=? AND p.who='role'`,
// ctx.OrgID, spaceID, ctx.OrgID, spaceID)
if err == sql.ErrNoRows {
err = nil