fix(home directory) #15 home directory not correct
This commit is contained in:
parent
cb96b00e8d
commit
394c276131
@ -17,6 +17,7 @@ def processData(data, template, **kwargs):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
userType = identifyUserType(row.get('user_type'))
|
userType = identifyUserType(row.get('user_type'))
|
||||||
|
userHome = parseHomefolder(row.get('Actor'),row.get('VirtualFolderName'))
|
||||||
try:
|
try:
|
||||||
processedData.append(template(identifyUtypecommand,\
|
processedData.append(template(identifyUtypecommand,\
|
||||||
prd_ext_tenant_name=kwargs.get('prd_ext_tenant_name'),\
|
prd_ext_tenant_name=kwargs.get('prd_ext_tenant_name'),\
|
||||||
@ -45,7 +46,7 @@ def processData(data, template, **kwargs):
|
|||||||
duration=row.get('TransferTime'),\
|
duration=row.get('TransferTime'),\
|
||||||
user_type=userType,\
|
user_type=userType,\
|
||||||
user_name=row.get('Actor'),\
|
user_name=row.get('Actor'),\
|
||||||
user_home_directory=row.get('VirtualFolderName'),\
|
user_home_directory=userHome,\
|
||||||
utype=identifyUtypecommand))
|
utype=identifyUtypecommand))
|
||||||
except UnboundLocalError:
|
except UnboundLocalError:
|
||||||
print(f'Problem row GUID:{row.get("TransactionGUID")} ::: TransactionObject:{row.get("TransactionObject")} Command: {row.get("Command")}')
|
print(f'Problem row GUID:{row.get("TransactionGUID")} ::: TransactionObject:{row.get("TransactionObject")} Command: {row.get("Command")}')
|
||||||
@ -80,7 +81,7 @@ def processData(data, template, **kwargs):
|
|||||||
user_uid=row.get('TransactionID'),\
|
user_uid=row.get('TransactionID'),\
|
||||||
user_type=userType,\
|
user_type=userType,\
|
||||||
user_name=row.get('Actor'),\
|
user_name=row.get('Actor'),\
|
||||||
user_home_directory=row.get('PhysicalFolderName'),\
|
user_home_directory=userHome,\
|
||||||
utype=identifyUtypetransactionObject\
|
utype=identifyUtypetransactionObject\
|
||||||
))
|
))
|
||||||
transactionLoginid.append(row.get('TransactionGUID'))
|
transactionLoginid.append(row.get('TransactionGUID'))
|
||||||
@ -100,6 +101,14 @@ def identifyUserType(obj):
|
|||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
def parseHomefolder(user, virtualfolder):
|
||||||
|
if user:
|
||||||
|
userSplit = f'/{user}/'
|
||||||
|
if virtualfolder:
|
||||||
|
if userSplit in virtualfolder:
|
||||||
|
home = virtualfolder.split(userSplit)[0] + userSplit
|
||||||
|
return home if home else None
|
||||||
|
|
||||||
def identifyUtype(obj):
|
def identifyUtype(obj):
|
||||||
"""Process Type of transaction based on string that passed in.
|
"""Process Type of transaction based on string that passed in.
|
||||||
Return transaction type."""
|
Return transaction type."""
|
||||||
|
14
test.py
14
test.py
@ -15,8 +15,6 @@ def builddict(keys,*args,**kwargs):
|
|||||||
dict[key] = kwargs.get(key)
|
dict[key] = kwargs.get(key)
|
||||||
print(dict)
|
print(dict)
|
||||||
|
|
||||||
testfolder = '/Usr/a/asdf/asf'
|
|
||||||
user = 'a'
|
|
||||||
|
|
||||||
def identifyUtype(obj):
|
def identifyUtype(obj):
|
||||||
"""Process Type of transaction based on string that passed in.
|
"""Process Type of transaction based on string that passed in.
|
||||||
@ -37,6 +35,14 @@ def identifyUtype(obj):
|
|||||||
else:
|
else:
|
||||||
return "other"
|
return "other"
|
||||||
|
|
||||||
transactionType = 'file_uploaded'
|
|
||||||
|
|
||||||
print(transactionType.split("_")[1].rstrip("d").rstrip("e"))
|
testfolder = '/Usr/a/asdf/asf/asdfas/asdfasdf/'
|
||||||
|
user = 'a'
|
||||||
|
|
||||||
|
def parsehomefolder(user, virtualfolder):
|
||||||
|
userSplit = f'/{user}/'
|
||||||
|
home = virtualfolder.split(userSplit)[0] + userSplit
|
||||||
|
print(home)
|
||||||
|
return home
|
||||||
|
|
||||||
|
a = parsehomefolder(user, testfolder)
|
Loading…
x
Reference in New Issue
Block a user