1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-08-05 05:25:27 +02:00

Replace permission related strings with typed values

This commit is contained in:
sauls8t 2018-03-02 14:47:58 +00:00
parent 99f0a16d71
commit 08f0c2cd0b
8 changed files with 72 additions and 58 deletions

View file

@ -110,10 +110,10 @@ func (h *Handler) Add(w http.ResponseWriter, r *http.Request) {
perm := permission.Permission{}
perm.OrgID = sp.OrgID
perm.Who = "user"
perm.Who = permission.UserPermission
perm.WhoID = ctx.UserID
perm.Scope = "object"
perm.Location = "space"
perm.Scope = permission.ScopeRow
perm.Location = permission.LocationSpace
perm.RefID = sp.RefID
perm.Action = "" // we send array for actions below
@ -800,10 +800,10 @@ func (h *Handler) Invite(w http.ResponseWriter, r *http.Request) {
perm := permission.Permission{}
perm.OrgID = sp.OrgID
perm.Who = "user"
perm.Who = permission.UserPermission
perm.WhoID = u.RefID
perm.Scope = "object"
perm.Location = "space"
perm.Scope = permission.ScopeRow
perm.Location = permission.LocationSpace
perm.RefID = sp.RefID
perm.Action = "" // we send array for actions below

View file

@ -64,10 +64,10 @@ func inviteNewUserToSharedSpace(ctx domain.RequestContext, rt *env.Runtime, s *d
perm := permission.Permission{}
perm.OrgID = sp.OrgID
perm.Who = "user"
perm.Who = permission.UserPermission
perm.WhoID = userID
perm.Scope = "object"
perm.Location = "space"
perm.Scope = permission.ScopeRow
perm.Location = permission.LocationSpace
perm.RefID = sp.RefID
perm.Action = "" // we send array for actions below

View file

@ -42,8 +42,8 @@ func TestSpace(t *testing.T) {
perm.OrgID = ctx.OrgID
perm.Who = "user"
perm.WhoID = ctx.UserID
perm.Scope = "object"
perm.Location = "space"
perm.Scope = permission.ScopeRow
perm.Location = permission.LocationSpace
perm.RefID = spaceID
perm.Action = "" // we send array for actions below
@ -109,8 +109,8 @@ func TestSpace(t *testing.T) {
perm.OrgID = ctx.OrgID
perm.Who = "user"
perm.WhoID = ctx.UserID
perm.Scope = "object"
perm.Location = "space"
perm.Scope = permission.ScopeRow
perm.Location = permission.LocationSpace
perm.RefID = spaceID2
perm.Action = "" // we send array for actions below
@ -170,8 +170,8 @@ func TestSpace(t *testing.T) {
perm.OrgID = ctx.OrgID
perm.Who = "user"
perm.WhoID = ctx.UserID
perm.Scope = "object"
perm.Location = "space"
perm.Scope = permission.ScopeRow
perm.Location = permission.LocationSpace
perm.RefID = spaceID
perm.Action = "" // we send array for actions below