当前位置: 首页>>代码示例>>Python>>正文


Python UserSessionManager.checkPermissions方法代码示例

本文整理汇总了Python中hypershade.usersession.UserSessionManager.checkPermissions方法的典型用法代码示例。如果您正苦于以下问题:Python UserSessionManager.checkPermissions方法的具体用法?Python UserSessionManager.checkPermissions怎么用?Python UserSessionManager.checkPermissions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在hypershade.usersession.UserSessionManager的用法示例。


在下文中一共展示了UserSessionManager.checkPermissions方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: kick

# 需要导入模块: from hypershade.usersession import UserSessionManager [as 别名]
# 或者: from hypershade.usersession.UserSessionManager import checkPermissions [as 别名]
def kick(caller,cn):
        """This allows the caller to kick another player; however, this will not override players with higher permission. Meaning, a master level permission can not kick someone with admin or trusted permission. To prevent the player from rejoining the server, they will also be banned for the default 60 minutes."""
	cn=int(cn)
	UserSessionManager.checkPermissions(caller,UserSessionManager[("ingame",cn)][1]) #check if the other person is more privileged
	
	ban(caller,sbserver.playerName(cn),"kicked by %s" % formatCaller(caller))
	triggerServerEvent("player_kicked",[caller,cn])
	return sbserver.playerKick(cn)
开发者ID:Pat61,项目名称:hyperserv,代码行数:10,代码来源:servercommands.py

示例2: loginOther

# 需要导入模块: from hypershade.usersession import UserSessionManager [as 别名]
# 或者: from hypershade.usersession.UserSessionManager import checkPermissions [as 别名]
def loginOther(caller,where,who,username=None):
        """This allows a player to use their permissions to login another player, but just like with kicking they can not login someone of higher permissions than themselves."""
	if where=="ingame":
		who=int(who)
	if username is None:
		username=UserSessionManager[caller][0]
	else:
		UserSessionManager.checkPermissions(caller,"admin")
	aswho=dict(userdatabase[username].items())
	succeedLogin((where,who),aswho)
开发者ID:amstan,项目名称:hyperserv,代码行数:12,代码来源:usercommands.py

示例3: loginOther

# 需要导入模块: from hypershade.usersession import UserSessionManager [as 别名]
# 或者: from hypershade.usersession.UserSessionManager import checkPermissions [as 别名]
def loginOther(caller,where,who,username=None):
	"""Logs in another player. This does not allow someone to login someone with higher permissions."""
	if where=="ingame":
		who=int(who)
	if username is None:
		username=UserSessionManager[caller][0]
	else:
		UserSessionManager.checkPermissions(caller,"admin")
	aswho=dict(userdatabase[username].items())
	succeedLogin((where,who),aswho)
开发者ID:crcollins,项目名称:hyperserv,代码行数:12,代码来源:usercommands.py

示例4: kick

# 需要导入模块: from hypershade.usersession import UserSessionManager [as 别名]
# 或者: from hypershade.usersession.UserSessionManager import checkPermissions [as 别名]
def kick(caller,cn):
	"""Kicks another player; however, this command does not work on players with higher permission. Kicking a player also gives them a 60 minute ban."""
	cn=int(cn)
	try:
		UserSessionManager.checkPermissions(caller,UserSessionManager[("ingame",cn)][1]) #check if the other person is more privileged
	except PermissionError:
		triggerServerEvent("player_kick_failed",[caller,cn])
		raise
	
	ban(caller,sbserver.playerName(cn),"kicked by %s" % formatCaller(caller))
	triggerServerEvent("player_kicked",[caller,cn])
	return sbserver.playerKick(cn)
开发者ID:crcollins,项目名称:hyperserv,代码行数:14,代码来源:servercommands.py

示例5: masterMode

# 需要导入模块: from hypershade.usersession import UserSessionManager [as 别名]
# 或者: from hypershade.usersession.UserSessionManager import checkPermissions [as 别名]
def masterMode(caller,name=None):
        """This changes the mastermode in the same way that /mastermode does without the need to have claimed master or admin."""
	if name==None:
		return sbserver.masterMode()
	mastermode=mastermodeNumber(name)
	
	if config["serverpublic"]=="1":
		if mastermode>=2:
			UserSessionManager.checkPermissions(caller,"trusted")
	if config["serverpublic"]=="2":
		if mastermode>=3:
			UserSessionManager.checkPermissions(caller,"trusted")
	
	return sbserver.setMasterMode(mastermode)
开发者ID:Pat61,项目名称:hyperserv,代码行数:16,代码来源:servercommands.py

示例6: masterMode

# 需要导入模块: from hypershade.usersession import UserSessionManager [as 别名]
# 或者: from hypershade.usersession.UserSessionManager import checkPermissions [as 别名]
def masterMode(caller,name=None):
	"""Changes the mastermode of the server."""
	if name==None:
		return sbserver.masterMode()
	mastermode=mastermodeNumber(name)
	
	if config["serverpublic"]=="1":
		if mastermode>=2:
			UserSessionManager.checkPermissions(caller,"trusted")
	if config["serverpublic"]=="2":
		if mastermode>=3:
			UserSessionManager.checkPermissions(caller,"trusted")
	
	return sbserver.setMasterMode(mastermode)
开发者ID:crcollins,项目名称:hyperserv,代码行数:16,代码来源:servercommands.py

示例7: checkforCS

# 需要导入模块: from hypershade.usersession import UserSessionManager [as 别名]
# 或者: from hypershade.usersession.UserSessionManager import checkPermissions [as 别名]
def checkforCS(caller,string):
	if string[0] in ['#','@']:
		string=string[1:]
		try:
			try:
				UserSessionManager.checkPermissions(caller,"trusted")
			except PermissionError:
				checkUntrustedCode(CSParser(string).parse())
			playerCS.executeby(caller,string)
		except:
			exctype,exctext,exctraceback=sys.exc_info()
			errormsg="%s: %s" % (exctype.__name__, exctext)
			playerCS.executeby(caller,"echo \"%s\"" % escape(errormsg))
			raise
		return 1
	else:
		return 0
开发者ID:deathstar,项目名称:hyperserv,代码行数:19,代码来源:cubescript.py

示例8: team

# 需要导入模块: from hypershade.usersession import UserSessionManager [as 别名]
# 或者: from hypershade.usersession.UserSessionManager import checkPermissions [as 别名]
def team(caller,*args):
        """This allows players to switch teams just like with /team."""
	if(len(args)==1):
		if(caller[0]=="ingame"):
			cn=caller[1]
		else:
			raise ServerError("You are not ingame. Please specify cn.")
	elif(len(args)==2):
		cn=args[0]
	else:
		raise TypeError("team takes either 1 or 2 arguments.")
	cn=int(cn)
	
	teamname=args[-1]
	
	if cn!=caller[1]:
		UserSessionManager.checkPermissions(caller,"master")
	
	sbserver.setTeam(cn,teamname)
开发者ID:Pat61,项目名称:hyperserv,代码行数:21,代码来源:servercommands.py

示例9: spectator

# 需要导入模块: from hypershade.usersession import UserSessionManager [as 别名]
# 或者: from hypershade.usersession.UserSessionManager import checkPermissions [as 别名]
def spectator(caller,boolean=None,cn=None):
        """If there are no arguments other than #spectator then the caller will be set to spectator. The first argument is a boolen that says what state of spectating the player will be (0 for not not a spectator and 1 for spectator), anything other than 0 will result in an them being a spectator. The cn is the client number of the player that the caller want spectated. If left off it will apply to the caller."""
	#empty args
	if boolean is None:
		boolean=1
	boolean=int(boolean)
	
	if cn is None:
		if(caller[0]=="ingame"):
			cn=caller[1]
		else:
			raise ServerError("You are not ingame. Please specify cn.")
	cn=int(cn)
	
	#check if it's a self call
	if caller[1]==cn:
		if boolean==0 and sbserver.masterMode()>=2:
			UserSessionManager.checkPermissions(caller,"master")
		spectatorHelpler(boolean,cn)
	else:
		UserSessionManager.checkPermissions(caller,"master")
		spectatorHelpler(boolean,cn)
开发者ID:Pat61,项目名称:hyperserv,代码行数:24,代码来源:servercommands.py

示例10: spectator

# 需要导入模块: from hypershade.usersession import UserSessionManager [as 别名]
# 或者: from hypershade.usersession.UserSessionManager import checkPermissions [as 别名]
def spectator(caller,boolean=None,cn=None):
	"""Sets spectator for the given cn. If the cn is left off it applies to the caller."""
	#empty args
	if boolean is None:
		boolean=1
	boolean=int(boolean)
	
	if cn is None:
		if(caller[0]=="ingame"):
			cn=caller[1]
		else:
			raise ServerError("You are not ingame. Please specify cn.")
	cn=int(cn)
	
	#check if it's a self call
	if caller[1]==cn:
		if boolean==0 and sbserver.masterMode()>=2:
			UserSessionManager.checkPermissions(caller,"master")
		spectatorHelpler(boolean,cn)
	else:
		UserSessionManager.checkPermissions(caller,"master")
		spectatorHelpler(boolean,cn)
开发者ID:crcollins,项目名称:hyperserv,代码行数:24,代码来源:servercommands.py

示例11: minsleft

# 需要导入模块: from hypershade.usersession import UserSessionManager [as 别名]
# 或者: from hypershade.usersession.UserSessionManager import checkPermissions [as 别名]
def minsleft(caller,time=None):
        """This sets the amount of time remianing on the map. This can only be used when the mapmode is not Coopedit"""
	if time is not None:
		UserSessionManager.checkPermissions(caller,"trusted")
		sbserver.setMinsRemaining(int(time))
	return sbserver.minutesRemaining()/60 #todo, fix the api, it shouldn't return seconds...
开发者ID:Pat61,项目名称:hyperserv,代码行数:8,代码来源:servercommands.py

示例12: wrapper

# 需要导入模块: from hypershade.usersession import UserSessionManager [as 别名]
# 或者: from hypershade.usersession.UserSessionManager import checkPermissions [as 别名]
	def wrapper(self,f,*args):
		owner=args[0].owner
		UserSessionManager.checkPermissions(owner,self.permissionRequirement)
		return f(owner,*args[1:])
开发者ID:Pat61,项目名称:hyperserv,代码行数:6,代码来源:cubescript.py

示例13: minsleft

# 需要导入模块: from hypershade.usersession import UserSessionManager [as 别名]
# 或者: from hypershade.usersession.UserSessionManager import checkPermissions [as 别名]
def minsleft(caller,time=None):
	"""Sets the amount of time remianing on the map. This can also be used in conjuction with #echo. Ex: #echo (minsleft)"""
	if time is not None:
		UserSessionManager.checkPermissions(caller,"trusted")
		sbserver.setMinsRemaining(int(time))
	return sbserver.minutesRemaining()/60 #todo, fix the api, it shouldn't return seconds...
开发者ID:crcollins,项目名称:hyperserv,代码行数:8,代码来源:servercommands.py


注:本文中的hypershade.usersession.UserSessionManager.checkPermissions方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。