Back to index

moin  1.9.0~rc2
Public Member Functions | Public Attributes
MoinMoin.script.account.disable.PluginScript Class Reference
Inheritance diagram for MoinMoin.script.account.disable.PluginScript:
Inheritance graph
[legend]
Collaboration diagram for MoinMoin.script.account.disable.PluginScript:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def mainloop
def init_request
def run
def logRuntime

Public Attributes

 request
 argv
 def_values
 parser
 args

Detailed Description

\
Purpose:
========
This tool allows you to disable user accounts via a command line interface.

Detailed Instructions:
======================
General syntax: moin [options] account disable [disable-options]

[options] usually should be:
--config-dir=/path/to/my/cfg/ --wiki-url=wiki.example.org/

[disable-options] see below:
0. Verify that you really want to disable the account.
   While there is a disable script, no such enable script exists.

1. To disable the user 'JohnSmith':
   moin ... account disable --name JohnSmith

2. To disable the user 'JohnSmith', based on his UID '1198872910.78.56322':
   moin ... account disable --uid 1198872910.78.56322

Definition at line 11 of file disable.py.


Constructor & Destructor Documentation

def MoinMoin.script.account.disable.PluginScript.__init__ (   self,
  argv,
  def_values 
)

Reimplemented from MoinMoin.script.MoinScript.

Definition at line 35 of file disable.py.

00035 
00036     def __init__(self, argv, def_values):
00037         MoinScript.__init__(self, argv, def_values)
00038         self.parser.add_option(
00039             "--uid", metavar="UID", dest="uid",
00040             help="Disable the user with user id UID."
00041         )
00042         self.parser.add_option(
00043             "--name", metavar="NAME", dest="uname",
00044             help="Disable the user with user name NAME."
00045         )


Member Function Documentation

def MoinMoin.script.MoinScript.init_request (   self) [inherited]
create request 

Definition at line 174 of file __init__.py.

00174 
00175     def init_request(self):
00176         """ create request """
00177         from MoinMoin.web.contexts import ScriptContext
00178         url = self.options.wiki_url or None
00179         self.request = ScriptContext(url, self.options.page)

Here is the caller graph for this function:

def MoinMoin.script.Script.logRuntime (   self) [inherited]
Print the total command run time. 

Definition at line 148 of file __init__.py.

00148 
00149     def logRuntime(self):
00150         """ Print the total command run time. """
00151         if self.options.show_timing:
00152             log("Needed %.3f secs." % (time.clock() - _start_time, ))
00153 

Here is the call graph for this function:

Reimplemented from MoinMoin.script.MoinScript.

Definition at line 46 of file disable.py.

00046 
00047     def mainloop(self):
00048         # we don't expect non-option arguments
00049         if len(self.args) != 0:
00050             self.parser.error("incorrect number of arguments")
00051 
00052         flags_given = self.options.uid or self.options.uname
00053         if not flags_given:
00054             self.parser.print_help()
00055             import sys
00056             sys.exit(1)
00057 
00058         self.init_request()
00059         request = self.request
00060 
00061         from MoinMoin import user
00062         if self.options.uid:
00063             u = user.User(request, self.options.uid)
00064         elif self.options.uname:
00065             u = user.User(request, None, self.options.uname)
00066 
00067         if not u.exists():
00068             print 'This user "%s" does not exists!' % u.name
00069             return
00070 
00071         print " %-20s %-25s %-35s" % (u.id, u.name, u.email),
00072         if not u.disabled: # only disable once
00073             u.disabled = 1
00074             u.name = "%s-%s" % (u.name, u.id)
00075             if u.email:
00076                 u.email = "%s-%s" % (u.email, u.id)
00077             u.subscribed_pages = "" # avoid using email
00078             u.save()
00079             print "- disabled."
00080         else:
00081             print "- is already disabled."

Here is the call graph for this function:

def MoinMoin.script.Script.run (   self,
  showtime = 1 
) [inherited]
Run the main function of a command. 

Definition at line 130 of file __init__.py.

00130 
00131     def run(self, showtime=1):
00132         """ Run the main function of a command. """
00133         global flag_quiet
00134         try:
00135             try:
00136                 self.options, self.args = self.parser.parse_args(self.argv)
00137                 flag_quiet = self.options.quiet
00138                 # ToDo check if we need to initialize request (self.init_request())
00139                 self.mainloop()
00140             except KeyboardInterrupt:
00141                 log("*** Interrupted by user!")
00142             except SystemExit:
00143                 showtime = 0
00144                 raise
00145         finally:
00146             if showtime:
00147                 self.logRuntime()

Here is the caller graph for this function:


Member Data Documentation

Definition at line 135 of file __init__.py.

Definition at line 102 of file __init__.py.

Definition at line 113 of file __init__.py.

Definition at line 178 of file __init__.py.


The documentation for this class was generated from the following file: