1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-19 21:29:42 +02:00

anon user space/categopry handling

This commit is contained in:
Harvey Kandola 2017-10-04 13:27:48 -04:00
parent 30321781c2
commit 7ce3adb65e
8 changed files with 36 additions and 38 deletions

View file

@ -136,7 +136,8 @@ func (h *Handler) SetSpacePermissions(w http.ResponseWriter, r *http.Request) {
// Only persist if there is a role!
if permission.HasAnyPermission(perm) {
// identify publically shared spaces
if perm.UserID == "0" {
if perm.UserID == "0" || perm.UserID == "" {
perm.UserID = "0"
hasEveryoneRole = true
}
@ -156,7 +157,7 @@ func (h *Handler) SetSpacePermissions(w http.ResponseWriter, r *http.Request) {
if _, isExisting := previousRoleUsers[perm.UserID]; !isExisting {
// we skip 'everyone' (user id != empty string)
if perm.UserID != "0" {
if perm.UserID != "0" && perm.UserID != "" {
existingUser, err := h.Store.User.Get(ctx, perm.UserID)
if err != nil {
response.WriteServerError(w, method, err)