@@ -196,20 +196,20 @@ function fix_code_permission_helper() {
196196 case $simulate in
197197 0)
198198 # Real action.
199- find " $1 " $detected_vendor_path \( -path " $1 " /sites/* /$file_folder_name -prune \) -o \( -path " $1 " /sites/* /$private_folder_name -prune \) -o \( -type $2 ! -perm $3 -print0 \) | xargs -r -0 -L4 chmod $3
199+ find " $1 " \( -path " $1 " /sites/* /$file_folder_name -prune \) -o \( -path " $1 " /sites/* /$private_folder_name -prune \) -o \( -type $2 ! -perm $3 -print0 \) | xargs -r -0 -L4 chmod $3
200200 ;;
201201
202202 1)
203203 # Simulate.
204- num=$( find " $1 " $detected_vendor_path \( -path " $1 " /sites/* /$file_folder_name -prune \) -o \( -path " $1 " /sites/* /$private_folder_name -prune \) -o \( -type $2 ! -perm $3 -print \) | wc -l)
204+ num=$( find " $1 " \( -path " $1 " /sites/* /$file_folder_name -prune \) -o \( -path " $1 " /sites/* /$private_folder_name -prune \) -o \( -type $2 ! -perm $3 -print \) | wc -l)
205205 printf " \n Code items with wrong permissions: $num "
206206 ;;
207207
208208 2)
209209 # Simulate verbosely.
210210 printf " \n Code files and directories that would have their permissions fixed: "
211211 # Use a variable to indent output.
212- items=$( find " $1 " $detected_vendor_path \( -path " $1 " /sites/* /$file_folder_name -prune \) -o \( -path " $1 " /sites/* /$private_folder_name -prune \) -o \( -type $2 ! -perm $3 -print \) )
212+ items=$( find " $1 " \( -path " $1 " /sites/* /$file_folder_name -prune \) -o \( -path " $1 " /sites/* /$private_folder_name -prune \) -o \( -type $2 ! -perm $3 -print \) )
213213 items=${items:- None}
214214 printf " \n ${items// $' \n ' / $' \n ' } \n"
215215 ;;
@@ -268,6 +268,16 @@ function fix_code_permissions() {
268268 printf " \n Setting permissions on code files to $code_file_perms under '$name '"
269269 fix_code_permission_helper " $1 " f " $code_file_perms "
270270
271+
272+ if [ ! -z " $detected_vendor_path " ]
273+ then
274+ printf " \n Setting permissions on vendor code directories to $code_dir_perms under '$detected_vendor_path '"
275+ fix_code_permission_helper " $detected_vendor_path " d " $code_dir_perms "
276+
277+ printf " \n Removing all permissions on vendor code files to other users ($vendor_code_file_perms ) under '$detected_vendor_path '"
278+ fix_code_permission_helper " $detected_vendor_path " f " $vendor_code_file_perms "
279+ fi
280+
271281}
272282
273283
368378# content files).
369379code_dir_perms=' u=rwx,g=rx,o='
370380code_file_perms=' u=rw,g=r,o='
381+ vendor_code_file_perms=' o='
371382content_dir_perms=" u=rwx,g=rw${group_executable_mode} ,o="
372383content_file_perms=' ug=rw,o='
373384
0 commit comments