DodoApp: List all apps if running in internal mode

Change-Id: Iea9f613495444c73c2f550ccadb58a0fbac79eec
diff --git a/core/installer/server/dodo-app/server.go b/core/installer/server/dodo-app/server.go
index 4fbd6c2..c5bc177 100644
--- a/core/installer/server/dodo-app/server.go
+++ b/core/installer/server/dodo-app/server.go
@@ -484,7 +484,13 @@
 		http.Error(w, "unauthorized", http.StatusUnauthorized)
 		return
 	}
-	apps, err := s.st.GetUserApps(user.(string))
+	var apps []string
+	var err error
+	if s.external {
+		apps, err = s.st.GetUserApps(user.(string))
+	} else {
+		apps, err = s.st.GetApps()
+	}
 	if err != nil {
 		http.Error(w, err.Error(), http.StatusInternalServerError)
 		return
@@ -542,7 +548,7 @@
 		http.Error(w, err.Error(), http.StatusInternalServerError)
 		return
 	}
-	if owner != user {
+	if s.external && owner != user {
 		http.Error(w, "unauthorized", http.StatusUnauthorized)
 		return
 	}
@@ -691,7 +697,7 @@
 		http.Error(w, err.Error(), http.StatusInternalServerError)
 		return
 	}
-	if owner != user {
+	if s.external && owner != user {
 		http.Error(w, "unauthorized", http.StatusUnauthorized)
 		return
 	}
@@ -755,7 +761,7 @@
 		http.Error(w, err.Error(), http.StatusInternalServerError)
 		return
 	}
-	if owner != user {
+	if s.external && owner != user {
 		http.Error(w, "unauthorized", http.StatusUnauthorized)
 		return
 	}