示例#1
0
import sys
import os

sys.path.append( os.environ["LCG_LOCATION"] )
import lfc

"""
# Using the lfc_getacl and lfc_setacl methods to add a user ACL
"""
if len(sys.argv) < 2:
        print "Syntax: %s <LFC_path>" % sys.argv[0]
        sys.exit(-1)

name = sys.argv[1]

nentries, acls_list = lfc.lfc_getacl(name, lfc.CA_MAXACLENTRIES)
print "nEntries %d" % nentries
print "len %d" % len(acls_list)
for i in acls_list:
        print "type %d" % i.a_type
        buffer = " "
        for j in range(0,100):
          buffer=buffer + " "   
        if( i.a_type == 1) :
                ret = lfc.lfc_getusrbyuid(i.a_id, buffer)
        else :
                ret = lfc.lfc_getgrpbygid(i.a_id, buffer)
        print "id %d %d %s" % (i.a_id, ret,  buffer) 
        print "perm %d" % i.a_perm
            res = str(replica.fileid)

            if options.surl:
                res += "|" + str(replica.sfn).replace("\0", "")

            if options.lfn:
                lfc.lfc_getpath("", replica.fileid, lfn)
                res = res + "|" + lfn.strip().replace("\0", "")

            if options.owner:
                buf = lfc.lfc_filestatg()
                lfc.lfc_statr(replica.sfn, buf)

                username = "******" * 1024
                if buf.uid not in users:
                    if lfc.lfc_getusrbyuid(buf.uid, username) == 0:
                        # Adding user to the list in order to resolve him/her only once
                        dn = username.strip().replace("\0", "")
                        users[buf.uid] = dn
                    else:
                        users[buf.uid] = "unknown"
                res = res + "|" + users[buf.uid]

            print res

            flags = lfc.CNS_LIST_CONTINUE
            replica = lfc.lfc_listreplicax("", se_name, "", flags, lista)

    except (KeyboardInterrupt, SystemExit):
        print "Interrupted by user."
示例#3
0
            res = str(replica.fileid)

            if options.surl:
                res += "|" + str(replica.sfn).replace('\0', '')

            if options.lfn:
                lfc.lfc_getpath("", replica.fileid, lfn)
                res = res + "|" + lfn.strip().replace('\0', '')

            if options.owner:
                buf = lfc.lfc_filestatg()
                lfc.lfc_statr(replica.sfn, buf)

                username = "******" * 1024
                if buf.uid not in users:
                    if lfc.lfc_getusrbyuid(buf.uid, username) == 0:
                        # Adding user to the list in order to resolve him/her only once
                        dn = username.strip().replace('\0', '')
                        users[buf.uid] = dn
                    else:
                        users[buf.uid] = "unknown"
                res = res + "|" + users[buf.uid]

            print res

            flags = lfc.CNS_LIST_CONTINUE
            replica = lfc.lfc_listreplicax("", se_name, "", flags, lista)

    except (KeyboardInterrupt, SystemExit):
        print "Interrupted by user."