Browse Source

Added toml file

Paolo Galli 4 years ago
parent
commit
a89de32f22
3 changed files with 21 additions and 5 deletions
  1. 11 0
      auth.toml
  2. 9 5
      lcmlog-server
  3. 1 0
      lcmlog-server-utils

+ 11 - 0
auth.toml

@@ -0,0 +1,11 @@
+["150"]
+auth=["GET 150","GET Admin","POST 150"]
+
+["Admin"]
+auth=["GET 150","GET Admin","POST 150","POST Admin","UPDATE"]
+
+["Valhalla"] # ex 150
+auth=["GET 150","GET Admin"]
+
+["Nirvana"] # ex admin
+auth=["GET 150","GET Admin","POST Admin"]

+ 9 - 5
lcmlog-server

@@ -250,11 +250,15 @@ def method_update():
 
 # Checks if the user has the permissions to use the requested method
 def auth(user_id, method, kind):
-	with open(DIR + "/auth/" + kind + "/" + method) as f:
-		for line in f:
-			if int(line) == user_id:
-				return
-	raise AuthError()
+	
+
+
+
+#	with open(DIR + "/auth/" + kind + "/" + method) as f:
+#		for line in f:
+#			if int(line) == user_id:
+#				return
+#	raise AuthError()
 
 
 #------------------------------------------------------------------------------

+ 1 - 0
lcmlog-server-utils

@@ -53,6 +53,7 @@ method_init()
 			touch $DIR/auth/Admin
 			touch $DIR/auth/Valhalla # ex 150
 			touch $DIR/auth/Nirvana  # ex admin
+			cp /usr/local/src/lcm-unimi/lcmlog-server/auth.toml $DIR/auth/auth.toml
 			echo "Completed."
 		fi