fix permisson bug
This commit is contained in:
@@ -135,7 +135,6 @@ class User:
|
|||||||
for chapter in course.chapters:
|
for chapter in course.chapters:
|
||||||
for lesson in chapter.lessons:
|
for lesson in chapter.lessons:
|
||||||
self.mongo.db.course_process.update_one({"user_uuid": self.user_uuid, "material_id": course_id}, {"$push": {"lesson_processs": ([], chapter.chapter_name, lesson.lesson_name)}})
|
self.mongo.db.course_process.update_one({"user_uuid": self.user_uuid, "material_id": course_id}, {"$push": {"lesson_processs": ([], chapter.chapter_name, lesson.lesson_name)}})
|
||||||
self.select_course.append(course_id)
|
|
||||||
self.mongo.db.users.update_one({"user_uuid": self.user_uuid}, {"$push": {"select_course": course_id}})
|
self.mongo.db.users.update_one({"user_uuid": self.user_uuid}, {"$push": {"select_course": course_id}})
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("=-=-=-=-=-=")
|
print("=-=-=-=-=-=")
|
||||||
|
|||||||
@@ -21,6 +21,8 @@
|
|||||||
<div class="course-info">
|
<div class="course-info">
|
||||||
<h3 class="course-name">{{course.name}}</h3>
|
<h3 class="course-name">{{course.name}}</h3>
|
||||||
<p class="course-description">{{course.description}}</p>
|
<p class="course-description">{{course.description}}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ def desktop(user_uuid, course_id, chapter_name, lesson_name):
|
|||||||
)
|
)
|
||||||
# 确保文件的所有权归 user_id
|
# 确保文件的所有权归 user_id
|
||||||
subprocess.run(
|
subprocess.run(
|
||||||
["sudo", "chown", f"{user_id}:shared_group_{user_id}", config_path],
|
["sudo", "chown","-R", f"flask:shared_group_{user_id}", config_path],
|
||||||
check=True
|
check=True
|
||||||
)
|
)
|
||||||
subprocess.run(
|
subprocess.run(
|
||||||
|
|||||||
1
Html/db/data/user/test0929.json
Normal file
1
Html/db/data/user/test0929.json
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{"username": "test0929"}
|
||||||
1
Html/db/data/user/yara.json
Normal file
1
Html/db/data/user/yara.json
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{"username": "yara"}
|
||||||
1
Html/db/data/user/yarat.json
Normal file
1
Html/db/data/user/yarat.json
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{"username": "yarat"}
|
||||||
1
Html/db/data/user/yizhiqinge.json
Normal file
1
Html/db/data/user/yizhiqinge.json
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{"username": "yizhiqinge"}
|
||||||
@@ -66,8 +66,8 @@ def vsc_like(user_uuid, user_id, course_id, chapter_name, lesson_name, port):
|
|||||||
print(f"Error adding user {user_id} to shared_group: {e}")
|
print(f"Error adding user {user_id} to shared_group: {e}")
|
||||||
try:
|
try:
|
||||||
subprocess.run(["sudo", "chown", "-R", f"flask:shared_group_{user_id}", path], check=True)
|
subprocess.run(["sudo", "chown", "-R", f"flask:shared_group_{user_id}", path], check=True)
|
||||||
subprocess.run(["sudo", "chmod", "-R", "750", user_root], check=True)
|
subprocess.run(["sudo", "chmod", "-R", "755", user_root], check=True)
|
||||||
subprocess.run(["sudo", "chmod", "-R", "770", path], check=True)
|
subprocess.run(["sudo", "chmod", "-R", "775", path], check=True)
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
print(f"Error changing directory {path} to shared_group_{user_id}: {e}")
|
print(f"Error changing directory {path} to shared_group_{user_id}: {e}")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user