本文整理汇总了Python中ovd.Platform.System.System.groupMember方法的典型用法代码示例。如果您正苦于以下问题:Python System.groupMember方法的具体用法?Python System.groupMember怎么用?Python System.groupMember使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ovd.Platform.System.System
的用法示例。
在下文中一共展示了System.groupMember方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: purgeGroup
# 需要导入模块: from ovd.Platform.System import System [as 别名]
# 或者: from ovd.Platform.System.System import groupMember [as 别名]
def purgeGroup(self):
users = System.groupMember(Config.group)
if users is None:
return False
ret = True
for user in users:
if user == Config.dav_user:
continue
Logger.debug("FileServer:: deleting user '%s'"%(user))
u = User(user)
u.clean()
if u.existSomeWhere():
Logger.error("FS: unable to del user %s"%(user))
ret = False
htgroup = HTGroup(Config.dav_group_file)
htgroup.purge()
try:
groups = [g.gr_name for g in grp.getgrall() if g.gr_name.startswith("ovd_share_")]
for g in groups:
System.groupDelete(g)
except Exception:
Logger.exception("Failed to purge groups")
ret = False
return ret
示例2: run
# 需要导入模块: from ovd.Platform.System import System [as 别名]
# 或者: from ovd.Platform.System.System import groupMember [as 别名]
def run(self):
self.status = Role.STATUS_RUNNING
while self.loop:
time.sleep(2)
if self.status == Role.STATUS_STOPPING:
if len(self.get_enabled_usershares()) > 0:
Logger.debug("FileServer:: Waiting for usershares removal")
continue
if len(System.groupMember(Config.group)) > 1: # because www-data
Logger.debug("FileServer:: Waiting for groups removal")
continue
break
self.status = Role.STATUS_STOP
示例3: purgeGroup
# 需要导入模块: from ovd.Platform.System import System [as 别名]
# 或者: from ovd.Platform.System.System import groupMember [as 别名]
def purgeGroup(self):
while True:
users = System.groupMember(self.ovd_group_name)
if users is None:
return False
if users == []:
return True
for user in users:
# todo : check if the users is connected, if yes logoff his session
if not System.userRemove(user):
return False
return False