New API reference documentation is available for testing at http://thewinecellarbook.com/daboDocTestAlt/. Please report any problems or suggestions on the dabo-users mailing list.

Class dSecurityManager

Class providing security services for Dabo applications, such as the
user logging in.

Properties

Application BaseClass BasePrefKey
Class LogEvents LoginAttemptsAllowed
LoginMessage LoginPause Name
Parent PreferenceManager RequireAppLogin
UserCaption UserGroups UserName

Events


Methods

afterInit afterLoginFailure afterLoginSuccess
autoBindEvents beforeInit bindEvent
bindEvents getAbsoluteName getProperties
getUserCaptionFromUserName getUserGroupsFromUserName initEvents
initProperties login raiseEvent
setProperties setPropertiesFromAtts unbindEvent
validateLogin




Properties

Application
Read-only object reference to the Dabo Application object.  (dApp).

(inherited from dObject)
BaseClass
The base Dabo class of the object. Read-only.  (class)

(inherited from dObject)
BasePrefKey
Base key used when saving/restoring preferences  (str)

(inherited from dObject)
Class
The class the object is based on. Read-only.  (class)

(inherited from dObject)
LogEvents
Specifies which events to log.  (list of strings)

If the first element is 'All', all events except the following listed events
will be logged.
Event logging is resource-intensive, so in addition to setting this LogEvents
property, you also need to make the following call:

	>>> dabo.eventLogging = True


(inherited from dObject)
LoginAttemptsAllowed
Specifies the number of attempts the user has to login successfully.
LoginMessage
Specifies the message to initially display on the login form.
LoginPause
Number of seconds to wait between successive login attempts.
Name
The name of the object.  (str)

(inherited from dObject)
Parent
The containing object.  (obj)

(inherited from dObject)
PreferenceManager
Reference to the Preference Management object  (dPref)

(inherited from dObject)
RequireAppLogin
Specifies whether the user is required to login at app startup.
UserCaption
The long descriptive name of the logged-on user.
UserGroups
The tuple of groups that the user belongs to.

Business objects can be configured to selectively allow/deny various types
of access based on the group(s) of the logged-in user.
UserName
The name of the logged-on user. Read-only.



Events




Methods

afterInit(self)
Subclass hook. Called after the object's __init__ has run fully.
Subclasses should place their __init__ code here in this hook, instead of
overriding __init__ directly, to avoid conflicting with base Dabo behavior.

(inherited from dObject)
afterLoginFailure(self)
Subclass hook called after an unsuccessful login attempt.
afterLoginSuccess(self)
Subclass hook called after a successful login.
autoBindEvents(self, force=True)
Automatically bind any on*() methods to the associated event.

User code only needs to define the callback, and Dabo will automatically
set up the event binding. This will satisfy lots of common cases where
you want an object or its parent to respond to the object's events.

To use this feature, just define a method on<EventName>(), or	if you
want a parent container to respond to the event, make a method in the
parent on<EventName>_<object Name or RegID>().

For example::
	
	class MyButton(dabo.ui.dButton):
		def onHit(self, evt):
			print "Hit!"

	class MyPanel(dabo.ui.dPanel):
		def afterInit(self):
			self.addObject(MyButton, RegID="btn1")

		def onHit_btn1(self, evt):
			print "panel: button hit!"

When the button is pressed, you'll see both 'hit' messages because of
auto event binding.

If you want to bind your events explicitly, you can turn off auto event
binding by calling::

	 dabo.autoBindEvents = False

This feature is inspired by PythonCard.

(inherited from EventMixin)
beforeInit(self, *args, **kwargs)
Subclass hook. Called before the object is fully instantiated.
Usually, user code should override afterInit() instead, but there may be
cases where you need to set an attribute before the init stage is fully
underway.

(inherited from dObject)
bindEvent(self, eventClass, function, _auto=False)
Bind a dEvent to a callback function.

(inherited from EventMixin)
bindEvents(self, bindings)
Bind a sequence of [dEvent, callback] lists.

(inherited from EventMixin)
getAbsoluteName(self)
Return the fully qualified name of the object.

(inherited from dObject)
getProperties(self, propertySequence=(), propsToSkip=(), ignoreErrors=False, *propertyArguments)
Returns a dictionary of property name/value pairs.

If a sequence of properties is passed, just those property values
will be returned. Otherwise, all property values will be returned.
The sequence of properties can be a list, tuple, or plain string
positional arguments. For instance, all of the following are
equivilent::

	print self.getProperties("Caption", "FontInfo", "Form")
	print self.getProperties(["Caption", "FontInfo", "Form"])
	t = ("Caption", "FontInfo", "Form")
	print self.getProperties(t)
	print self.getProperties(\*t)

An exception will be raised if any passed property names don't
exist, aren't actual properties, or are not readable (do not have
getter functions).

However, if an exception is raised from the property getter function,
the exception will get caught and used as the property value in the
returned property dictionary. This allows the property list to be
returned even if some properties can't be evaluated correctly by the
object yet.

(inherited from PropertyHelperMixin)
getUserCaptionFromUserName(self, userName)
Return a descriptive name of the user from the short userName.

This is a subclass hook: you should override this method with your own
code that converts the short userName into something more descriptive,
such as 'pmcnett' -> 'Paul McNett'. The default behavior just echoes
back the userName.
getUserGroupsFromUserName(self, userName)
Return the tuple of groups that userName belongs to.

This is a subclass hook: you must override this method with your own
code that returns a tuple filled with the groups the user belongs to.
The identifiers used for the groups must match the group identifiers
as coded in your business objects.
initEvents(self)
Hook for subclasses. User code should do custom event binding
here, such as::
	
	self.bindEvent(dEvents.GotFocus, self.customGotFocusHandler)
	

(inherited from dObject)
initProperties(self)
Hook for subclasses. User subclasses should set properties
here, such as::
	
	self.Name = "MyTextBox"
	self.BackColor = (192,192,192)
	

(inherited from dObject)
login(self)
Ask the ui to display the login form to the user.

Validate the results, and return True if validation succeeds.
raiseEvent(self, eventClass, uiEvent=None, *args, **kwargs)
Send the event to all registered listeners.

If uiEvent is sent, dEvents.Event will be able to parse it for useful
information to send along to the callback. 

Additional arguments, if any, are sent along to the constructor	of the
event. While this feature exists so that UI-lib event handlers can pass
along information (such as the keystroke information in a key event), user
code may pass along additional arguments as well, which	will exist in the
event.EventData dictionary property.

In most cases, user code should call raiseEvent() with
the event class (dEvents.Hit, for example) as the only parameter.

(inherited from EventMixin)
setProperties(self, propDict={}, ignoreErrors=False, **propKw)
Sets a group of properties on the object all at once.

You have the following options for sending the properties:
	
	1) Property/Value pair dictionary
	2) Keyword arguments
	3) Both

The following examples all do the same thing::

	self.setProperties(FontBold=True, ForeColor="Red")
	self.setProperties({"FontBold": True, "ForeColor": "Red"})
	self.setProperties({"FontBold": True}, ForeColor="Red")


(inherited from PropertyHelperMixin)
setPropertiesFromAtts(self, propDict={}, ignoreExtra=True, context=None)
Sets a group of properties on the object all at once. This
is different from the regular setProperties() method because
it only accepts a dict containing prop:value pairs, and it
assumes that the value is always a string. It will convert
the value to the correct type for the property, and then set
the property to that converted value. If the value needs to be evaluated
in a specific namespace, pass that as the 'context' parameter.

(inherited from PropertyHelperMixin)
unbindEvent(self, eventClass=None, function=None)
Remove a previously registered event binding.

Removes all registrations that exist for the given binding for this
object. If event is None, all bindings for the passed function are
removed. If function is None, all bindings for the passed event are
removed. If both event and function are None, all event bindings are
removed.

(inherited from EventMixin)
validateLogin(self, user, password)
Return True if the passed user and password combination is valid.

This is a subclass hook: you must override this method with your own
code that does whatever is required to verify the login info. This would
probably include looking up the information in a database.

Dabo 0.9.4 (rev. 7089)
9 Feb 2012 23:31:09