Skip to content

Commit d0d57e0

Browse files
[Bugfix:Plagiarism] Set provided code directory permissions (#91)
1 parent b35a2fe commit d0d57e0

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

bin/run_lichen.sh

+12-8
Original file line numberDiff line numberDiff line change
@@ -37,21 +37,25 @@ rm -f "${BASEPATH}/provided_code/submission.concatenated"
3737
rm -f "${BASEPATH}/provided_code/tokens.json"
3838
rm -f "${BASEPATH}/provided_code/hashes.txt"
3939

40-
# create these directories if they don't already exist
40+
# Make a logs directory so we can start logging any errors
4141
mkdir -p "${BASEPATH}/logs"
42-
mkdir -p "${BASEPATH}/provided_code"
43-
mkdir -p "${BASEPATH}/provided_code/files"
44-
mkdir -p "${BASEPATH}/other_gradeables"
45-
mkdir -p "${BASEPATH}/users"
4642

4743
# Run Lichen and exit if an error occurs
4844
{
45+
# Create these directories if they don't already exist
46+
mkdir -p "${BASEPATH}/provided_code"
47+
[ -d "${BASEPATH}/provided_code/files" ] || {
48+
# If PHP hasn't created a files directory already, create one and set the permissions
49+
# to allow PHP to edit files here in the future
50+
mkdir "${BASEPATH}/provided_code/files"
51+
chmod g+wx "${BASEPATH}/provided_code/files" || exit 1
52+
}
53+
mkdir -p "${BASEPATH}/other_gradeables"
54+
mkdir -p "${BASEPATH}/users"
55+
4956
############################################################################
5057
# Finish setting up Lichen run
5158

52-
# The default is r-x and we need PHP to be able to write if edits are made to the provided code
53-
chmod g=rwxs "${BASEPATH}/provided_code/files" || exit 1
54-
5559
cd "$(dirname "${0}")" || exit 1
5660

5761
############################################################################

0 commit comments

Comments
 (0)