Package entropy :: Package services :: Module commands

Source Code for Module entropy.services.commands

 1  # -*- coding: utf-8 -*- 
 2  ''' 
 3      # DESCRIPTION: 
 4      # Entropy Object Oriented Interface 
 5   
 6      Copyright (C) 2007-2009 Fabio Erculiani 
 7   
 8      This program is free software; you can redistribute it and/or modify 
 9      it under the terms of the GNU General Public License as published by 
10      the Free Software Foundation; either version 2 of the License, or 
11      (at your option) any later version. 
12   
13      This program is distributed in the hope that it will be useful, 
14      but WITHOUT ANY WARRANTY; without even the implied warranty of 
15      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
16      GNU General Public License for more details. 
17   
18      You should have received a copy of the GNU General Public License 
19      along with this program; if not, write to the Free Software 
20      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
21  ''' 
22   
23  from entropy.services.skel import SocketCommands 
24   
25 -class phpBB3(SocketCommands):
26 27 import entropy.dump as dumpTools 28 import entropy.tools as entropyTools
29 - def __init__(self, HostInterface):
30 31 SocketCommands.__init__(self, HostInterface, inst_name = "phpbb3-commands") 32 33 self.valid_commands = { 34 'is_user': { 35 'auth': True, 36 'built_in': False, 37 'cb': self.docmd_is_user, 38 'args': ["authenticator"], 39 'as_user': False, 40 'desc': "returns whether the username linked with the session belongs to a simple user", 41 'syntax': "<SESSION_ID> is_user", 42 'from': unicode(self), # from what class 43 }, 44 'is_developer': { 45 'auth': True, 46 'built_in': False, 47 'cb': self.docmd_is_developer, 48 'args': ["authenticator"], 49 'as_user': False, 50 'desc': "returns whether the username linked with the session belongs to a developer", 51 'syntax': "<SESSION_ID> is_developer", 52 'from': unicode(self), # from what class 53 }, 54 'is_moderator': { 55 'auth': True, 56 'built_in': False, 57 'cb': self.docmd_is_moderator, 58 'args': ["authenticator"], 59 'as_user': False, 60 'desc': "returns whether the username linked with the session belongs to a moderator", 61 'syntax': "<SESSION_ID> is_moderator", 62 'from': unicode(self), # from what class 63 }, 64 'is_administrator': { 65 'auth': True, 66 'built_in': False, 67 'cb': self.docmd_is_administrator, 68 'args': ["authenticator"], 69 'as_user': False, 70 'desc': "returns whether the username linked with the session belongs to an administrator", 71 'syntax': "<SESSION_ID> is_administrator", 72 'from': unicode(self), # from what class 73 }, 74 }
75
76 - def docmd_is_user(self, authenticator):
77 return authenticator.is_user(),'ok'
78
79 - def docmd_is_developer(self, authenticator):
80 return authenticator.is_developer(),'ok'
81
82 - def docmd_is_administrator(self, authenticator):
83 return authenticator.is_administrator(),'ok'
84
85 - def docmd_is_moderator(self, authenticator):
86 return authenticator.is_moderator(),'ok'
87