Changeset 2232


Ignore:
Timestamp:
Jul 19, 2016, 2:54:17 PM (3 years ago)
Author:
kbut
Message:

add function to list folder

Location:
n4d-lliurex-base/trunk/fuentes
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • n4d-lliurex-base/trunk/fuentes/debian/changelog

    r741 r2232  
     1n4d-lliurex-base (0.14) xenial; urgency=high
     2
     3  * Added function to list path content by users
     4
     5 -- Raul Rodrigo Segura <raurodse@gmail.com>  Tue, 19 Jul 2016 14:53:07 +0200
     6
    17n4d-lliurex-base (0.13) xenial; urgency=high
    28
  • n4d-lliurex-base/trunk/fuentes/install-files/etc/n4d/conf.d/FileUtils

    r138 r2232  
    44class=FileUtils
    55[METHODS]
     6(us)listDir=*
  • n4d-lliurex-base/trunk/fuentes/install-files/usr/share/n4d/python-plugins/FileUtils.py

    r138 r2232  
    6565
    6666        #def restore
     67
     68        def listDir(self, user, path):
     69                exitstatus = os.system("su -c 'test -r %s' %s"%(path,user))
     70                if exitstatus == 0:
     71                        result = {'folders':[],'files':[]}
     72                        for root, folders, files in os.walk(path):
     73                                result['folders'] = folders
     74                                result['files'] = files
     75                                break
     76                        return {'status':True,'msg':result}
     77                return {'status':False,'msg':'Permission deny'}
     78               
     79        #de listDir
Note: See TracChangeset for help on using the changeset viewer.