Package entropy :: Package services :: Module commands

Source Code for Module entropy.services.commands

 1  # -*- coding: utf-8 -*- 
 2  """ 
 3   
 4      @author: Fabio Erculiani <lxnay@sabayonlinux.org> 
 5      @contact: lxnay@sabayonlinux.org 
 6      @copyright: Fabio Erculiani 
 7      @license: GPL-2 
 8   
 9      B{Entropy Services Command Interfaces}. 
10   
11  """ 
12  from entropy.services.skel import SocketCommands 
13   
14 -class phpBB3(SocketCommands):
15 16 import entropy.dump as dumpTools 17 import entropy.tools as entropyTools
18 - def __init__(self, HostInterface):
19 20 SocketCommands.__init__(self, HostInterface, inst_name = "phpbb3-commands") 21 22 self.valid_commands = { 23 'is_user': { 24 'auth': True, 25 'built_in': False, 26 'cb': self.docmd_is_user, 27 'args': ["authenticator"], 28 'as_user': False, 29 'desc': "returns whether the username linked with the session belongs to a simple user", 30 'syntax': "<SESSION_ID> is_user", 31 'from': unicode(self), # from what class 32 }, 33 'is_developer': { 34 'auth': True, 35 'built_in': False, 36 'cb': self.docmd_is_developer, 37 'args': ["authenticator"], 38 'as_user': False, 39 'desc': "returns whether the username linked with the session belongs to a developer", 40 'syntax': "<SESSION_ID> is_developer", 41 'from': unicode(self), # from what class 42 }, 43 'is_moderator': { 44 'auth': True, 45 'built_in': False, 46 'cb': self.docmd_is_moderator, 47 'args': ["authenticator"], 48 'as_user': False, 49 'desc': "returns whether the username linked with the session belongs to a moderator", 50 'syntax': "<SESSION_ID> is_moderator", 51 'from': unicode(self), # from what class 52 }, 53 'is_administrator': { 54 'auth': True, 55 'built_in': False, 56 'cb': self.docmd_is_administrator, 57 'args': ["authenticator"], 58 'as_user': False, 59 'desc': "returns whether the username linked with the session belongs to an administrator", 60 'syntax': "<SESSION_ID> is_administrator", 61 'from': unicode(self), # from what class 62 }, 63 }
64
65 - def docmd_is_user(self, authenticator):
66 return authenticator.is_user(),'ok'
67
68 - def docmd_is_developer(self, authenticator):
69 return authenticator.is_developer(),'ok'
70
71 - def docmd_is_administrator(self, authenticator):
72 return authenticator.is_administrator(),'ok'
73
74 - def docmd_is_moderator(self, authenticator):
75 return authenticator.is_moderator(),'ok'
76