예제 #1
0
 def fix_file_permissions(self, operation, path, path_src=None):
     apppath = path
     if apppath.endswith(utils.path_sep):
         apppath = apppath[0:len(apppath) - 1]
     apppath_src = path_src
     if apppath_src is not None:
         if apppath_src.endswith(utils.path_sep):
             apppath_src = apppath_src[0:len(apppath_src) - 1]
     else:
         apppath_src = utils.path_dirname(path)
     stat_info = utils.path_stat(apppath_src)
     mode = stat.S_IMODE(stat_info.st_mode)
     if operation == "CREATE_DIRECTORY":
         utils.path_change_permissions(path, mode)
         utils.path_change_owner(path, stat_info.st_uid, stat_info.st_gid)
     elif operation == "CREATE_FILE":
         utils.path_change_permissions(
             path, ((mode & ~stat.S_IXUSR) & ~stat.S_IXGRP) & ~stat.S_IXOTH)
         utils.path_change_owner(path, stat_info.st_uid, stat_info.st_gid)
     elif operation == "COPY_DIRECTORY" or operation == "COPY_FILE":
         utils.path_change_permissions(path, mode)
         stat_info = utils.path_stat(utils.path_dirname(
             path))  #PRENDE IL GRUPPO E L'UTENTE DELLA CARTELLA PADRE
         utils.path_change_owner(path, stat_info.st_uid, stat_info.st_gid)
     elif operation == "MOVE_DIRECTORY" or operation == "MOVE_FILE":
         utils.path_change_permissions(path, mode)
         utils.path_change_owner(path, stat_info.st_uid, stat_info.st_gid)
예제 #2
0
 def set_file_permissions(self,path,prms):
     if "mode" in prms:
         utils.path_change_permissions(path, int(prms["mode"],8))
     if "owner" in prms and "group" in prms:
         import pwd
         import grp
         try:
             uid = pwd.getpwnam(prms["owner"]).pw_uid
         except:
             uid=int(prms["owner"])
         try:
             gid = grp.getgrnam(prms["group"]).gr_gid
         except:
             gid=int(prms["group"])
         utils.path_change_owner(path, uid, gid)
예제 #3
0
 def fix_perm(fn):
     utils.path_change_owner(fn, uid, -1)
     utils.path_change_permissions(
         fn, stat.S_IRUSR | stat.S_IWUSR | stat.S_IRGRP
         | stat.S_IWGRP)
예제 #4
0
 def fix_perm(fn):
     if agent.is_mac() and self._appconsoleid!=None:
         utils.path_change_owner(fn, self._appconsoleid, -1)
         utils.path_change_permissions(fn, stat.S_IRUSR | stat.S_IWUSR | stat.S_IRGRP | stat.S_IWGRP)