Ticket #1873: 1873_3.patch

File 1873_3.patch, 2.5 KB (added by Wiktor Walc, 16 years ago)
  • editor/filemanager/connectors/py/config.py

     
    6565# Allowed Resource Types
    6666ConfigAllowedTypes = ['File', 'Image', 'Flash', 'Media']
    6767
     68# After file is uploaded, sometimes it is required to change its permissions
     69# so that it was possible to access it at the later time.
     70# If possible, it is recommended to set more restrictive permissions, like 0755.
     71# Set to 0 to disable this feature.
     72# Note: not needed on Windows-based servers.
     73ChmodOnUpload = 0755
     74
     75# See comments above.
     76# Used when creating folders that does not exist.
     77ChmodOnFolderCreate = 0755
     78
    6879# Do not touch this 3 lines, see "Configuration settings for each Resource Type"
    6980AllowedExtensions = {}; DeniedExtensions = {};
    7081FileTypesPath = {}; FileTypesAbsolutePath = {};
  • editor/filemanager/connectors/py/fckcommands.py

     
    110110        def createServerFolder(self, folderPath):
    111111                "Purpose: physically creates a folder on the server"
    112112                # No need to check if the parent exists, just create all hierachy
    113                 oldumask = os.umask(0)
    114                 os.makedirs(folderPath,mode=0755)
    115                 os.umask( oldumask )
     113               
     114                try:
     115                        permissions = Config.ChmodOnFolderCreate
     116                        if not permissions:
     117                                os.makedirs(folderPath)                         
     118                except AttributeError: #ChmodOnFolderCreate undefined
     119                        permissions = 0755
     120               
     121                if permissions:
     122                        oldumask = os.umask(0)
     123                        os.makedirs(folderPath,mode=0755)
     124                        os.umask( oldumask )                   
    116125
    117126class UploadFileCommandMixin (object):
    118127        def uploadFile(self, resourceType, currentFolder):
     
    168177                                                fout.close()
    169178
    170179                                                if os.path.exists ( newFilePath ):
    171                                                         oldumask = os.umask(0)
    172                                                         os.chmod( newFilePath, 0755 )
    173                                                         os.umask( oldumask )
     180                                                        doChmod = False
     181                                                        try:
     182                                                                doChmod = Config.ChmodOnUpload
     183                                                                permissions = Config.ChmodOnUpload
     184                                                        except AttributeError: #ChmodOnUpload undefined
     185                                                                doChmod = True
     186                                                                permissions = 0755
     187                                                        if ( doChmod ):
     188                                                                oldumask = os.umask(0)
     189                                                                os.chmod( newFilePath, permissions )
     190                                                                os.umask( oldumask )
    174191
    175192                                                newFileUrl = self.webUserFilesFolder + currentFolder + newFileName
    176193
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy