summaryrefslogtreecommitdiffstats
path: root/src/com.gluster.storage.management.gateway/WebContent/scripts/Utils.py
diff options
context:
space:
mode:
authorShireesh Anjal <anjalshireesh@gmail.com>2011-08-10 02:03:48 -0700
committerShireesh Anjal <anjalshireesh@gmail.com>2011-08-10 02:03:48 -0700
commit5c4d1742737d33c050e35ac1cb9289024ecbb355 (patch)
tree786e841a3facee76c68c78fc2fd2f2ae7f43d5e0 /src/com.gluster.storage.management.gateway/WebContent/scripts/Utils.py
parente83fc81fbc1c3379b7ae116f10fdbe3ac93ffe87 (diff)
parentd03d4570da36b01032e6e2b0c80f6c36b98bbe1f (diff)
Merge pull request #218 from TimothyAsir/master
Bug 3374 - [CIFS] updating volume with a non-existent user succeeds.
Diffstat (limited to 'src/com.gluster.storage.management.gateway/WebContent/scripts/Utils.py')
-rw-r--r--src/com.gluster.storage.management.gateway/WebContent/scripts/Utils.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/com.gluster.storage.management.gateway/WebContent/scripts/Utils.py b/src/com.gluster.storage.management.gateway/WebContent/scripts/Utils.py
index 82f8b7b6..be5df757 100644
--- a/src/com.gluster.storage.management.gateway/WebContent/scripts/Utils.py
+++ b/src/com.gluster.storage.management.gateway/WebContent/scripts/Utils.py
@@ -1084,3 +1084,18 @@ def getGlusterVersion():
if not rv["Stdout"]:
return None
return rv["Stdout"].strip().split()[1]
+
+def getCifsUserUid(userName):
+ try:
+ fp = open(Globals.CIFS_USER_FILE)
+ content = fp.read()
+ fp.close()
+ except IOError, e:
+ Utils.log("failed to read file %s: %s" % (Globals.CIFS_USER_FILE, str(e)))
+ return False
+
+ for line in content.strip().split():
+ tokens = line.split(":")
+ if tokens[1] == userName:
+ return int(tokens[0])
+ return None