Package AccessGrid :: Package Security :: Module Role :: Class Role
[show private | hide private]
[frames | no frames]

Class Role


A Role instance represents a group of Subjects (users). The group probably has some contextual meaning, such as "Users found in the Venue" or "Users who can modify my data".

For example, if a Role is called "AllowedEntry", it is most likely a list of users users are allowed to enter something.
Method Summary
  __init__(self, role_name, subjects)
  __str__(self)
This method provides a string reprsentation of the Role.
  _repr_(self)
This method creates a DOM document that represents the role.
  AddSubject(self, subject)
This new AddSubject is more strict than the old one.
  FindSubject(self, subjectName)
This method retrieves the subject for the specified name.
  GetName(self)
An accessor for the Role name attribute.
  GetRequireDefault(self)
An accessor to set if we are allowed to remove default subject from this role.
  GetSubjectListAsStrings(self)
This method returns the subject list as strings.
  GetSubjects(self)
An accessor for the list of subjects that are in this Role.
  HasSubject(self, subject)
Thie method verifies that a subject is in this Role.
  RemoveSubject(self, subject)
This method removes the specified subject from the role.
  SetRequireDefault(self, flag)
An accessor to check if we are allowed to remove dafault subject from this role.
  SetSubjects(self, sl)
An accessor to set the list of subjects associated with this Role.
  ToXML(self, doc, ref)
This method creates the XML specific to the Role class.

Class Variable Summary
string TYPE: the type of role, used in doing Role Arithematic.

Method Details

__init__(self, role_name, subjects=None)
(Constructor)

Parameters:
role_name - the name of the role to create
           (type=string)
subjects - a list of subjects to initialize this role with.
           (type=a list of AccessGrid.Security.Subject objects)

__str__(self)
(Informal representation operator)

This method provides a string reprsentation of the Role.
Returns:
string

_repr_(self)

This method creates a DOM document that represents the role.
Returns:
a string formatted as XML.

AddSubject(self, subject)

This new AddSubject is more strict than the old one. It only works with subject objects.
Parameters:
subject - the subject to add to this role
           (type=AccessGrid.Security.Subject object)
Raises:
InvalidSubject - when the subject specified is not a subclass of the AccessGrid.Security.Subject base class.

FindSubject(self, subjectName)

This method retrieves the subject for the specified name.
Parameters:
subjectName - a string representing the subject.
           (type=string)
Returns:
an AccessGrid.Security.Subject object or None.

GetName(self)

An accessor for the Role name attribute.
Returns:
string form of the name

GetRequireDefault(self)

An accessor to set if we are allowed to remove default subject from this role.
Returns:
1 if this role requires default subject, otherwise 0.

GetSubjectListAsStrings(self)

This method returns the subject list as strings.
Returns:
a list of strings of subjects.

GetSubjects(self)

An accessor for the list of subjects that are in this Role.
Returns:
a list of AccessGrid.Security.Subject objects.

HasSubject(self, subject)

Thie method verifies that a subject is in this Role.
Parameters:
subject - the subject to be verified.
           (type=an AccessGrid.Security.Subject object.)
Returns:
0 if not in this Role, 1 if in this Role.

RemoveSubject(self, subject)

This method removes the specified subject from the role.
Parameters:
subject - the subject to be removed.
           (type=AccessGrid.Security.Subject object)
Raises:
InvalidSubject - when the subject passed in not a subclass of the AccessGrid.Security.Subject base class.

SetRequireDefault(self, flag)

An accessor to check if we are allowed to remove dafault subject from this role.
Parameters:
flag - 1 if this role requires default subject, otherwise 0.
           (type=int)

SetSubjects(self, sl)

An accessor to set the list of subjects associated with this Role. This replaces any previously existing list.
Parameters:
sl - a list of subjects to set this Role with.
           (type=a list of AccessGrid.Security.Subject objects.)

ToXML(self, doc, ref=0)

This method creates the XML specific to the Role class.
Parameters:
doc - a DOM document to create the Role XML from.
           (type=xml.dom.minidom document)
Returns:
a dom document node.

Class Variable Details

TYPE

the type of role, used in doing Role Arithematic.
Type:
string
Value:
'Invalid'                                                              

Generated by Epydoc 2.1 on Thu Apr 14 16:39:29 2005 http://epydoc.sf.net