Skip to content

Commit

Permalink
[Bugfix:Plagiarism] Set provided code directory permissions (#91)
Browse files Browse the repository at this point in the history
  • Loading branch information
williamjallen authored Oct 3, 2022
1 parent b35a2fe commit d0d57e0
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions bin/run_lichen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,25 @@ rm -f "${BASEPATH}/provided_code/submission.concatenated"
rm -f "${BASEPATH}/provided_code/tokens.json"
rm -f "${BASEPATH}/provided_code/hashes.txt"

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

# Run Lichen and exit if an error occurs
{
# Create these directories if they don't already exist
mkdir -p "${BASEPATH}/provided_code"
[ -d "${BASEPATH}/provided_code/files" ] || {
# If PHP hasn't created a files directory already, create one and set the permissions
# to allow PHP to edit files here in the future
mkdir "${BASEPATH}/provided_code/files"
chmod g+wx "${BASEPATH}/provided_code/files" || exit 1
}
mkdir -p "${BASEPATH}/other_gradeables"
mkdir -p "${BASEPATH}/users"

############################################################################
# Finish setting up Lichen run

# The default is r-x and we need PHP to be able to write if edits are made to the provided code
chmod g=rwxs "${BASEPATH}/provided_code/files" || exit 1

cd "$(dirname "${0}")" || exit 1

############################################################################
Expand Down

0 comments on commit d0d57e0

Please sign in to comment.