ucsschool.lib.models package

Submodules

ucsschool.lib.models.attributes module

exception ucsschool.lib.models.attributes.ValidationError[source]

Bases: exceptions.Exception

class ucsschool.lib.models.attributes.Attribute(label, aka=None, udm_name=None, required=False, unlikely_to_change=False, internal=False, map_to_udm=True)[source]

Bases: object

syntax = None
extended = False
value_type = None
value_default = None
udm_name = None
_validate_syntax(values, syntax=None)[source]
validate(value)[source]
class ucsschool.lib.models.attributes.CommonName(label, aka=None)[source]

Bases: ucsschool.lib.models.attributes.Attribute

udm_name = 'name'
syntax = None
validate(value)[source]
class ucsschool.lib.models.attributes.Username(label, aka=None)[source]

Bases: ucsschool.lib.models.attributes.CommonName

udm_name = 'username'
syntax

alias of uid_umlauts

class ucsschool.lib.models.attributes.DHCPServerName(label, aka=None)[source]

Bases: ucsschool.lib.models.attributes.CommonName

udm_name = 'server'
class ucsschool.lib.models.attributes.DHCPServiceName(label, aka=None)[source]

Bases: ucsschool.lib.models.attributes.CommonName

udm_name = 'service'
class ucsschool.lib.models.attributes.GroupName(label, aka=None)[source]

Bases: ucsschool.lib.models.attributes.CommonName

syntax

alias of gid

class ucsschool.lib.models.attributes.SchoolClassName(label, aka=None)[source]

Bases: ucsschool.lib.models.attributes.GroupName

_validate_syntax(values, syntax=None)[source]
class ucsschool.lib.models.attributes.ShareName(label, aka=None)[source]

Bases: ucsschool.lib.models.attributes.CommonName

syntax

alias of string_numbers_letters_dots_spaces

class ucsschool.lib.models.attributes.SubnetName(label, aka=None)[source]

Bases: ucsschool.lib.models.attributes.CommonName

udm_name = 'subnet'
syntax

alias of reverseLookupSubnet

class ucsschool.lib.models.attributes.DHCPSubnetName(label, aka=None)[source]

Bases: ucsschool.lib.models.attributes.SubnetName

udm_name = 'subnet'
syntax

alias of ipv4Address

class ucsschool.lib.models.attributes.SchoolName(label, aka=None)[source]

Bases: ucsschool.lib.models.attributes.CommonName

udm_name = 'name'
validate(value)[source]
class ucsschool.lib.models.attributes.DCName(label, aka=None, udm_name=None, required=False, unlikely_to_change=False, internal=False, map_to_udm=True)[source]

Bases: ucsschool.lib.models.attributes.Attribute

validate(value)[source]
class ucsschool.lib.models.attributes.Firstname(label, aka=None, udm_name=None, required=False, unlikely_to_change=False, internal=False, map_to_udm=True)[source]

Bases: ucsschool.lib.models.attributes.Attribute

udm_name = 'firstname'
class ucsschool.lib.models.attributes.Lastname(label, aka=None, udm_name=None, required=False, unlikely_to_change=False, internal=False, map_to_udm=True)[source]

Bases: ucsschool.lib.models.attributes.Attribute

udm_name = 'lastname'
class ucsschool.lib.models.attributes.Birthday(label, aka=None, udm_name=None, required=False, unlikely_to_change=False, internal=False, map_to_udm=True)[source]

Bases: ucsschool.lib.models.attributes.Attribute

udm_name = 'birthday'
syntax

alias of iso8601Date

class ucsschool.lib.models.attributes.Email(label, aka=None, udm_name=None, required=False, unlikely_to_change=False, internal=False, map_to_udm=True)[source]

Bases: ucsschool.lib.models.attributes.Attribute

udm_name = 'mailPrimaryAddress'
syntax

alias of primaryEmailAddressValidDomain

validate(value)[source]
class ucsschool.lib.models.attributes.Password(label, aka=None, udm_name=None, required=False, unlikely_to_change=False, internal=False, map_to_udm=True)[source]

Bases: ucsschool.lib.models.attributes.Attribute

udm_name = 'password'
class ucsschool.lib.models.attributes.Disabled(label, aka=None, udm_name=None, required=False, unlikely_to_change=False, internal=False, map_to_udm=True)[source]

Bases: ucsschool.lib.models.attributes.Attribute

udm_name = 'disabled'
syntax

alias of disabled

class ucsschool.lib.models.attributes.SchoolAttribute(label, aka=None)[source]

Bases: ucsschool.lib.models.attributes.CommonName

udm_name = None
class ucsschool.lib.models.attributes.SchoolClassesAttribute(label, aka=None, udm_name=None, required=False, unlikely_to_change=False, internal=False, map_to_udm=True)[source]

Bases: ucsschool.lib.models.attributes.Attribute

udm_name = None
value_type

alias of dict

value_default

alias of dict

class ucsschool.lib.models.attributes.SchoolClassAttribute(label, aka=None, udm_name=None, required=False, unlikely_to_change=False, internal=False, map_to_udm=True)[source]

Bases: ucsschool.lib.models.attributes.Attribute

class ucsschool.lib.models.attributes.Description(label, aka=None, udm_name=None, required=False, unlikely_to_change=False, internal=False, map_to_udm=True)[source]

Bases: ucsschool.lib.models.attributes.Attribute

udm_name = 'description'
class ucsschool.lib.models.attributes.DisplayName(label, aka=None, udm_name=None, required=False, unlikely_to_change=False, internal=False, map_to_udm=True)[source]

Bases: ucsschool.lib.models.attributes.Attribute

udm_name = 'displayName'
extended = True
class ucsschool.lib.models.attributes.EmptyAttributes(label, aka=None, udm_name=None, required=False, unlikely_to_change=False, internal=False, map_to_udm=True)[source]

Bases: ucsschool.lib.models.attributes.Attribute

udm_name = 'emptyAttributes'
class ucsschool.lib.models.attributes.ContainerPath(label, aka=None, udm_name=None, required=False, unlikely_to_change=False, internal=False, map_to_udm=True)[source]

Bases: ucsschool.lib.models.attributes.Attribute

syntax

alias of boolean

class ucsschool.lib.models.attributes.ShareFileServer(label, aka=None, udm_name=None, required=False, unlikely_to_change=False, internal=False, map_to_udm=True)[source]

Bases: ucsschool.lib.models.attributes.Attribute

syntax

alias of UDM_Objects

extended = True
class ucsschool.lib.models.attributes.Groups(label, aka=None, udm_name=None, required=False, unlikely_to_change=False, internal=False, map_to_udm=True)[source]

Bases: ucsschool.lib.models.attributes.Attribute

syntax

alias of GroupDN

value_type

alias of list

class ucsschool.lib.models.attributes.Users(label, aka=None, udm_name=None, required=False, unlikely_to_change=False, internal=False, map_to_udm=True)[source]

Bases: ucsschool.lib.models.attributes.Attribute

udm_name = 'users'
syntax

alias of UserDN

value_type

alias of list

class ucsschool.lib.models.attributes.IPAddress(label, aka=None, udm_name=None, required=False, unlikely_to_change=False, internal=False, map_to_udm=True)[source]

Bases: ucsschool.lib.models.attributes.Attribute

udm_name = 'ip'
syntax

alias of ipAddress

value_type

alias of list

class ucsschool.lib.models.attributes.SubnetMask(label, aka=None, udm_name=None, required=False, unlikely_to_change=False, internal=False, map_to_udm=True)[source]

Bases: ucsschool.lib.models.attributes.Attribute

class ucsschool.lib.models.attributes.DHCPSubnetMask(label, aka=None, udm_name=None, required=False, unlikely_to_change=False, internal=False, map_to_udm=True)[source]

Bases: ucsschool.lib.models.attributes.Attribute

udm_name = 'subnetmask'
syntax

alias of v4netmask

class ucsschool.lib.models.attributes.DHCPServiceAttribute(label, aka=None, udm_name=None, required=False, unlikely_to_change=False, internal=False, map_to_udm=True)[source]

Bases: ucsschool.lib.models.attributes.Attribute

class ucsschool.lib.models.attributes.BroadcastAddress(label, aka=None, udm_name=None, required=False, unlikely_to_change=False, internal=False, map_to_udm=True)[source]

Bases: ucsschool.lib.models.attributes.Attribute

udm_name = 'broadcastaddress'
syntax

alias of ipv4Address

class ucsschool.lib.models.attributes.NetworkBroadcastAddress(label, aka=None, udm_name=None, required=False, unlikely_to_change=False, internal=False, map_to_udm=True)[source]

Bases: ucsschool.lib.models.attributes.Attribute

syntax

alias of ipv4Address

class ucsschool.lib.models.attributes.NetworkAttribute(label, aka=None, udm_name=None, required=False, unlikely_to_change=False, internal=False, map_to_udm=True)[source]

Bases: ucsschool.lib.models.attributes.Attribute

udm_name = 'network'
syntax

alias of ipAddress

class ucsschool.lib.models.attributes.Netmask(label, aka=None, udm_name=None, required=False, unlikely_to_change=False, internal=False, map_to_udm=True)[source]

Bases: ucsschool.lib.models.attributes.Attribute

udm_name = 'netmask'
syntax

alias of netmask

class ucsschool.lib.models.attributes.MACAddress(label, aka=None, udm_name=None, required=False, unlikely_to_change=False, internal=False, map_to_udm=True)[source]

Bases: ucsschool.lib.models.attributes.Attribute

udm_name = 'mac'
syntax

alias of MAC_Address

value_type

alias of list

class ucsschool.lib.models.attributes.InventoryNumber(label, aka=None, udm_name=None, required=False, unlikely_to_change=False, internal=False, map_to_udm=True)[source]

Bases: ucsschool.lib.models.attributes.Attribute

class ucsschool.lib.models.attributes.Hosts(label, aka=None, udm_name=None, required=False, unlikely_to_change=False, internal=False, map_to_udm=True)[source]

Bases: ucsschool.lib.models.attributes.Attribute

udm_name = 'hosts'
value_type

alias of list

syntax

alias of UDM_Objects

class ucsschool.lib.models.attributes.Schools(label, aka=None, udm_name=None, required=False, unlikely_to_change=False, internal=False, map_to_udm=True)[source]

Bases: ucsschool.lib.models.attributes.Attribute

udm_name = 'school'
value_type

alias of list

value_default

alias of list

syntax

alias of string

extended = True
class ucsschool.lib.models.attributes.RecordUID(label, aka=None, udm_name=None, required=False, unlikely_to_change=False, internal=False, map_to_udm=True)[source]

Bases: ucsschool.lib.models.attributes.Attribute

udm_name = 'ucsschoolRecordUID'
syntax

alias of string

extended = True
class ucsschool.lib.models.attributes.SourceUID(label, aka=None, udm_name=None, required=False, unlikely_to_change=False, internal=False, map_to_udm=True)[source]

Bases: ucsschool.lib.models.attributes.Attribute

udm_name = 'ucsschoolSourceUID'
syntax

alias of string

extended = True
class ucsschool.lib.models.attributes.RolesSyntax[source]

Bases: univention.admin.syntax.string

regex = <_sre.SRE_Pattern object>
classmethod parse(text)[source]
class ucsschool.lib.models.attributes.Roles(*args, **kwargs)[source]

Bases: ucsschool.lib.models.attributes.Attribute

udm_name = 'ucsschoolRole'
value_type

alias of list

value_default

alias of list

syntax

alias of RolesSyntax

extended = True

ucsschool.lib.models.base module

exception ucsschool.lib.models.base.NoObject[source]

Bases: univention.admin.uexceptions.noObject

exception ucsschool.lib.models.base.UnknownModel(dn, cls)[source]

Bases: ucsschool.lib.models.base.NoObject

exception ucsschool.lib.models.base.WrongModel(dn, model, wrong_model)[source]

Bases: ucsschool.lib.models.base.NoObject

exception ucsschool.lib.models.base.WrongObjectType(dn, cls)[source]

Bases: ucsschool.lib.models.base.NoObject

exception ucsschool.lib.models.base.MultipleObjectsError(objs, *args, **kwargs)[source]

Bases: exceptions.Exception

class ucsschool.lib.models.base.UCSSchoolHelperAbstractClass(name=None, school=None, **kwargs)[source]

Bases: object

Base class of all UCS@school models. Hides UDM.

Attributes used for a class are defined like this:

class MyModel(UCSSchoolHelperAbstractClass):
        my_attribute = Attribute('Label', required=True, udm_name='myAttr')

From there on my_attribute=value may be passed to :py:meth:__init__(), my_model.my_attribute can be accessed and the value will be saved as obj['myAttr'] in UDM when saving this instance. If an attribute of a base class is not wanted, it can be overridden:

class MyModel(UCSSchoolHelperAbstractClass):
        school = None

Meta information about the class are defined like this:

class MyModel(UCSSchoolHelperAbstractClass):
        class Meta:
                udm_module = 'my/model'

The meta information is then accessible in cls._meta.

Important functions:

:py:meth:__init__(**kwargs):
kwargs should be the defined attributes
:py:meth:create(lo)
lo is an LDAP connection, specifically univention.admin.access. creates a new object. Returns False is the object already exists. And True after the creation
:py:meth:modify(lo)
modifies an existing object. Returns False if the object does not exist and True after the modification (regardless whether something actually changed or not)
:py:meth:remove(lo)
deletes the object. Returns False if the object does not exist and True after the deletion.
:py:meth:get_all(lo, school, filter_str, easy_filter=False)

classmethod; retrieves all objects found for this school. filter can be a string that is used to narrow down a search. Each property of the class’ udm_module that is include_in_default_search is queried for that string. Example:

User.get_all(lo, 'school', filter_str='name', easy_filter=True)

will search in cn=users,ou=school,$base for users/user UDM objects with |(username=*name*)(firstname=*name*)(...) and return User objects (not UDM objects) With easy_filter=False (default) it will use this very filter_str

:py:meth:get_container(school)
a classmethod that points to the container where new instances are created and existing ones are searched.
:py:meth:dn
property, current distinguishable name of the instance. Calculated on the fly, it changes if instance.name or instance.school changes. instance.old_dn will be set to the original dn when the instance was created
:py:meth:get_udm_object(lo)
searches UDM for an entry that corresponds to self. Normally uses the old_dn or dn. If cls._meta.name_is_unique then any object with self.name will match
:py:meth:exists(lo)
whether this object can be found in UDM.
:py:meth:from_udm_obj(udm_obj, school, lo)
classmethod; maps the info of udm_obj into a new instance (and sets school)
:py:meth:from_dn(dn, school, lo)
finds dn in LDAP and uses from_udm_obj
:py:meth:get_first_udm_obj(lo, filter_str)
returns the first found object of type cls._meta.udm_module that matches an arbitrary filter_str

More features:

Validation:
There are some auto checks built in: Attributes of the model that have a UDM syntax attached are validated against this syntax. Attributes that are required must be present. Attributes that are unlikely_to_change give a warning (not error) if the object already exists with other values. If the Meta information states that name_is_unique, the complete LDAP is searched for the instance’s name before continuing. :py:meth:validate() can be further customized.
Hooks:

Before :py:meth:create, :py:meth:modify, :py:meth:move and :py:meth:remove, hooks are called if :py:meth:build_hook_line() returns something. If the operation was successful, another set of hooks are called.

/usr/share/ucs-school-import/hooks/%(module)s_{create|modify|move|remove}_{pre|post}.d/ are called with the name of a temporary file containing the hook_line via run-parts. %(module)s is 'ucc' for cls._meta.udm_module == 'computers/ucc' by default and can be explicitely set with:

class Meta:
        hook_path = 'computer'

Initializes a new instance with kwargs. Not every kwarg is accepted, though: The name must be defined as a attribute at class level (or by a base class). All attributes are initialized at least with None Sets self.old_dn to self.dn, i.e. the name in __init__ will determine the old_dn, changing it after __init__ will result in trying to move the object!

_cache = {}
_machine_connection = None
_search_base_cache = {}
_initialized_udm_modules = []
_empty_hook_paths = set([])
hook_sep_char = '\t'
hook_path = '/usr/share/ucs-school-import/hooks/'
name = <ucsschool.lib.models.attributes.CommonName object>
school = <ucsschool.lib.models.attributes.SchoolAttribute object>
classmethod cache(*args, **kwargs)[source]

Initializes a new instance and caches it for subsequent calls. Useful when using School.cache(school_name) a lot in different functions, in loops, etc.

classmethod invalidate_all_caches()[source]
classmethod invalidate_cache()[source]
classmethod supports_school()[source]
classmethod supports_schools()[source]
classmethod get_machine_connection()[source]

get a cached ldap connection to the DC Master using this host’s credentials

position
dn

Generates a DN where the lib would assume this instance to be. Changing name or school of self will most likely change the outcome of self.dn as well

set_dn(dn)[source]

Does not really set dn, as this is generated on-the-fly. Instead, sets old_dn in case it was missed in the beginning or after create/modify/remove/move Also resets cached udm_obj as it may point to somewhere else

validate(lo, validate_unlikely_changes=False)[source]
validate_roles(lo)[source]
add_warning(attribute, warning_message)[source]
add_error(attribute, error_message)[source]
exists(lo)[source]
exists_outside_school(lo)[source]
call_hooks(hook_time, func_name)[source]

Calls run-parts in os.path.join(self.hook_path, ‘%s_%s_%s.d’ % (self._meta.hook_path, func_name, hook_time)) if self.build_hook_line(hook_time, func_name) returns a non-empty string

Usage in lib itself:
hook_time in [‘pre’, ‘post’] func_name in [‘create’, ‘modify’, ‘remove’]

In the lib, post-hooks are only called if the corresponding function returns True

build_hook_line(hook_time, func_name)[source]

Must be overridden if the model wants to support hooks. Do so by something like: return self._build_hook_line(self.attr1, self.attr2, ‘constant’)

_alter_udm_obj(udm_obj)[source]
create(lo, validate=True)[source]

Creates a new UDM instance. Calls pre-hooks. If the object already exists, returns False. If the object does not yet exist, creates it, returns True and calls post-hooks.

create_without_hooks(lo, validate)[source]
create_without_hooks_roles(lo)[source]

Run by py:meth:create_without_hooks() before py:meth:validate() (and thus before py:meth:do_create()).

do_create(udm_obj, lo)[source]

Actual udm_obj manipulation. Override this if you want to further change values of udm_obj, e.g. def do_create(self, udm_obj, lo):

udm_obj[‘used_in_ucs_school’] = ‘1’ super(MyModel, self).do_create(udm_obj, lo)
modify(lo, validate=True, move_if_necessary=None)[source]

Modifies an existing UDM instance. Calls pre-hooks. If the object does not exist, returns False. If the object exists, modifies it, returns True and calls post-hooks.

modify_without_hooks(lo, validate=True, move_if_necessary=None)[source]
modify_without_hooks_roles(udm_obj)[source]

Run by py:meth:modify_without_hooks() before py:meth:do_modify().

update_ucsschool_roles()[source]

Run by py:meth:modify_without_hooks() before py:meth:validate().

do_modify(udm_obj, lo)[source]

Actual udm_obj manipulation. Override this if you want to further change values of udm_obj, e.g. def do_modify(self, udm_obj, lo):

udm_obj[‘used_in_ucs_school’] = ‘1’ super(MyModel, self).do_modify(udm_obj, lo)
move(lo, udm_obj=None, force=False)[source]
move_without_hooks(lo, udm_obj, force=False)[source]
do_move(udm_obj, lo)[source]
do_move_roles(udm_obj, lo, old_school, new_school)[source]
change_school(school, lo)[source]
do_school_change(udm_obj, lo, old_school)[source]
remove(lo)[source]

Removes an existing UDM instance. Calls pre-hooks. If the object does not exist, returns False. If the object exists, removes it, returns True and calls post-hooks.

remove_without_hooks(lo)[source]
classmethod get_name_from_dn(dn)[source]
classmethod get_school_from_dn(dn)[source]
classmethod find_field_label_from_name(field)[source]
get_error_msg()[source]
get_warning_msg()[source]
create_validation_msg(items)[source]
get_udm_object(lo)[source]

Returns the UDM object that corresponds to self. If self._meta.name_is_unique it searches for any UDM object with self.name. If not (which is the default) it searches for self.old_dn or self.dn Returns None if no object was found. Caches the result, even None If you want to re-search, you need to explicitely set self._udm_obj_searched = False

get_school_obj(lo)[source]
get_superordinate(lo)[source]
get_own_container()[source]
classmethod get_container(school)[source]

raises NotImplementedError by default. Needs to be overridden!

classmethod get_search_base(school_name)[source]
classmethod init_udm_module(lo)[source]
classmethod get_all(lo, school, filter_str=None, easy_filter=False, superordinate=None)[source]

Returns a list of all objects that can be found in cls.get_container() with the correct udm_module If filter_str is given, all udm properties with include_in_default_search are queried for that string (so that it should be the value)

classmethod lookup(lo, school, filter_s='', superordinate=None)[source]
classmethod _attrs_for_easy_filter()[source]
classmethod build_easy_filter(filter_str)[source]
classmethod from_udm_obj(udm_obj, school, lo)[source]

Creates a new instance with attributes of the udm_obj. Uses get_class_for_udm_obj()

classmethod get_class_for_udm_obj(udm_obj, school)[source]

Returns cls by default. Can be overridden for base classes: class User(UCSSchoolHelperAbstractClass):

@classmethod def get_class_for_udm_obj(cls, udm_obj, school)

if something:
return SpecialUser

return cls

class SpecialUser(User):
pass

Now, User.get_all() will return a list of User and SpecialUser objects If this function returns None for a udm_obj, that obj will not yield a new instance in get_all() and from_udm_obj() will return None for that udm_obj

classmethod from_dn(dn, school, lo, superordinate=None)[source]

Returns a new instance based on the UDM object found at dn raises noObject if the udm_module does not match the dn or dn is not found

classmethod get_only_udm_obj(lo, filter_str, superordinate=None, base=None)[source]

Returns the one UDM object of class cls._meta.udm_module that matches a given filter. If more than one is found, a MultipleObjectsError is raised If none is found, None is returned

classmethod get_first_udm_obj(lo, filter_str, superordinate=None)[source]

Returns the first UDM object of class cls._meta.udm_module that matches a given filter

classmethod find_udm_superordinate(dn, lo)[source]
to_dict()[source]

Returns a dictionary somewhat representing this instance. This dictionary is usually used when sending the instance to a browser as JSON. By default the attributes are present as well as the dn and the udm_module.

_map_func_name_to_code(func_name)[source]
_build_hook_line(*args)[source]
_attributes = {'school': <ucsschool.lib.models.attributes.SchoolAttribute object>, 'name': <ucsschool.lib.models.attributes.CommonName object>}
_meta = <ucsschool.lib.models.meta.UCSSchoolHelperOptions object>
logger = <Proxy at 0x7fbbafcdbf80 wrapping <celery.utils.log.ProcessAwareLogger object> at 0x7fbba7c95250 with factory <function <lambda>>>
class ucsschool.lib.models.base.RoleSupportMixin[source]

Bases: object

Methods required when using the ucsschool_roles / ucsschoolRoles attribute.

Inherit from this class and add this to your class:

ucsschool_roles = Roles(_(‘Roles’), aka=[‘Roles’])

default_roles = []
_school_in_name = False
_school_in_name_prefix = False
get_schools()[source]
get_schools_from_udm_obj(udm_obj)[source]
roles_as_dicts

Get self.ucsschool_roles as a dict.

do_move_roles(udm_obj, lo, old_school, new_school)[source]
validate_roles(lo)[source]
create_without_hooks_roles(lo)[source]

Run by py:meth:create_without_hooks() before py:meth:validate() (and thus before py:meth:do_create()).

update_ucsschool_roles()[source]

Run by py:meth:modify_without_hooks() before py:meth:validate().

Add ucsschool_roles entries of context_type=school to object, if it got new/additional school(s) and object has no role(s) in those yet.

Delete ucsschool_roles entries of context_type=school of object, if it was removed from school(s).

ucsschool.lib.models.computer module

class ucsschool.lib.models.computer.AnyComputer(name=None, school=None, **kwargs)[source]

Bases: ucsschool.lib.models.base.UCSSchoolHelperAbstractClass

Initializes a new instance with kwargs. Not every kwarg is accepted, though: The name must be defined as a attribute at class level (or by a base class). All attributes are initialized at least with None Sets self.old_dn to self.dn, i.e. the name in __init__ will determine the old_dn, changing it after __init__ will result in trying to move the object!

classmethod get_container(school=None)[source]
class Meta[source]
udm_module = 'computers/computer'
AnyComputer._attributes = {'school': <ucsschool.lib.models.attributes.SchoolAttribute object>, 'name': <ucsschool.lib.models.attributes.CommonName object>}
AnyComputer._meta = <ucsschool.lib.models.meta.UCSSchoolHelperOptions object>
AnyComputer.logger = <Proxy at 0x7fbbb0882cb0 wrapping <celery.utils.log.ProcessAwareLogger object> at 0x7fbba7cca910 with factory <function <lambda>>>
class ucsschool.lib.models.computer.SchoolDC(name=None, school=None, **kwargs)[source]

Bases: ucsschool.lib.models.base.UCSSchoolHelperAbstractClass

Initializes a new instance with kwargs. Not every kwarg is accepted, though: The name must be defined as a attribute at class level (or by a base class). All attributes are initialized at least with None Sets self.old_dn to self.dn, i.e. the name in __init__ will determine the old_dn, changing it after __init__ will result in trying to move the object!

classmethod get_container(school)[source]
classmethod get_class_for_udm_obj(udm_obj, school)[source]
_attributes = {'school': <ucsschool.lib.models.attributes.SchoolAttribute object>, 'name': <ucsschool.lib.models.attributes.CommonName object>}
_meta = <ucsschool.lib.models.meta.UCSSchoolHelperOptions object>
logger = <Proxy at 0x7fbbb08851b8 wrapping <celery.utils.log.ProcessAwareLogger object> at 0x7fbba7cca910 with factory <function <lambda>>>
class ucsschool.lib.models.computer.SchoolDCSlave(name=None, school=None, **kwargs)[source]

Bases: ucsschool.lib.models.base.RoleSupportMixin, ucsschool.lib.models.computer.SchoolDC

Initializes a new instance with kwargs. Not every kwarg is accepted, though: The name must be defined as a attribute at class level (or by a base class). All attributes are initialized at least with None Sets self.old_dn to self.dn, i.e. the name in __init__ will determine the old_dn, changing it after __init__ will result in trying to move the object!

groups = <ucsschool.lib.models.attributes.Groups object>
ucsschool_roles = <ucsschool.lib.models.attributes.Roles object>
do_create(udm_obj, lo)[source]
_alter_udm_obj(udm_obj)[source]
get_schools_from_udm_obj(udm_obj)[source]
move_without_hooks(lo, udm_obj=None, force=False)[source]
class Meta[source]
udm_module = 'computers/domaincontroller_slave'
name_is_unique = True
allow_school_change = True
SchoolDCSlave._attributes = {'groups': <ucsschool.lib.models.attributes.Groups object>, 'school': <ucsschool.lib.models.attributes.SchoolAttribute object>, 'name': <ucsschool.lib.models.attributes.CommonName object>, 'ucsschool_roles': <ucsschool.lib.models.attributes.Roles object>}
SchoolDCSlave._meta = <ucsschool.lib.models.meta.UCSSchoolHelperOptions object>
SchoolDCSlave.logger = <Proxy at 0x7fbbb0885200 wrapping <celery.utils.log.ProcessAwareLogger object> at 0x7fbba7cca910 with factory <function <lambda>>>
class ucsschool.lib.models.computer.SchoolComputer(name=None, school=None, **kwargs)[source]

Bases: ucsschool.lib.models.base.UCSSchoolHelperAbstractClass

Initializes a new instance with kwargs. Not every kwarg is accepted, though: The name must be defined as a attribute at class level (or by a base class). All attributes are initialized at least with None Sets self.old_dn to self.dn, i.e. the name in __init__ will determine the old_dn, changing it after __init__ will result in trying to move the object!

ip_address = <ucsschool.lib.models.attributes.IPAddress object>
subnet_mask = <ucsschool.lib.models.attributes.SubnetMask object>
mac_address = <ucsschool.lib.models.attributes.MACAddress object>
inventory_number = <ucsschool.lib.models.attributes.InventoryNumber object>
zone = <ucsschool.lib.models.attributes.Attribute object>
type_name = 'Computer'
DEFAULT_PREFIX_LEN = 24
classmethod lookup(lo, school, filter_s='', superordinate=None)[source]

This override limits the returned objects to actual ucsschoolComputers. Does not contain SchoolDC slaves and others anymore.

get_inventory_numbers()[source]
teacher_computer

True if the computer is a teachers computer.

_alter_udm_obj(udm_obj)[source]
classmethod get_container(school)[source]
create(lo, validate=True)[source]
create_without_hooks(lo, validate)[source]
modify_without_hooks(lo, validate=True, move_if_necessary=None)[source]
get_ipv4_network()[source]
_ip_is_set_to_subnet(ipv4_network=None)[source]
get_network()[source]
create_network(lo)[source]
validate(lo, validate_unlikely_changes=False)[source]
classmethod get_class_for_udm_obj(udm_obj, school)[source]
classmethod from_udm_obj(udm_obj, school, lo)[source]
build_hook_line(hook_time, func_name)[source]
to_dict()[source]
class Meta[source]
udm_module = 'computers/computer'
name_is_unique = True
SchoolComputer._attributes = {'school': <ucsschool.lib.models.attributes.SchoolAttribute object>, 'inventory_number': <ucsschool.lib.models.attributes.InventoryNumber object>, 'name': <ucsschool.lib.models.attributes.CommonName object>, 'zone': <ucsschool.lib.models.attributes.Attribute object>, 'subnet_mask': <ucsschool.lib.models.attributes.SubnetMask object>, 'mac_address': <ucsschool.lib.models.attributes.MACAddress object>, 'ip_address': <ucsschool.lib.models.attributes.IPAddress object>}
SchoolComputer._meta = <ucsschool.lib.models.meta.UCSSchoolHelperOptions object>
SchoolComputer.logger = <Proxy at 0x7fbbb0885248 wrapping <celery.utils.log.ProcessAwareLogger object> at 0x7fbba7cca910 with factory <function <lambda>>>
class ucsschool.lib.models.computer.WindowsComputer(name=None, school=None, **kwargs)[source]

Bases: ucsschool.lib.models.base.RoleSupportMixin, ucsschool.lib.models.computer.SchoolComputer

Initializes a new instance with kwargs. Not every kwarg is accepted, though: The name must be defined as a attribute at class level (or by a base class). All attributes are initialized at least with None Sets self.old_dn to self.dn, i.e. the name in __init__ will determine the old_dn, changing it after __init__ will result in trying to move the object!

type_name = 'Windows system'
ucsschool_roles = <ucsschool.lib.models.attributes.Roles object>
default_roles = ['win_computer']
class Meta[source]

Bases: ucsschool.lib.models.computer.Meta

udm_module = 'computers/windows'
hook_path = 'computer'
WindowsComputer._attributes = {'subnet_mask': <ucsschool.lib.models.attributes.SubnetMask object>, 'school': <ucsschool.lib.models.attributes.SchoolAttribute object>, 'inventory_number': <ucsschool.lib.models.attributes.InventoryNumber object>, 'name': <ucsschool.lib.models.attributes.CommonName object>, 'zone': <ucsschool.lib.models.attributes.Attribute object>, 'mac_address': <ucsschool.lib.models.attributes.MACAddress object>, 'ip_address': <ucsschool.lib.models.attributes.IPAddress object>, 'ucsschool_roles': <ucsschool.lib.models.attributes.Roles object>}
WindowsComputer._meta = <ucsschool.lib.models.meta.UCSSchoolHelperOptions object>
WindowsComputer.logger = <Proxy at 0x7fbbb0885290 wrapping <celery.utils.log.ProcessAwareLogger object> at 0x7fbba7cca910 with factory <function <lambda>>>
class ucsschool.lib.models.computer.MacComputer(name=None, school=None, **kwargs)[source]

Bases: ucsschool.lib.models.base.RoleSupportMixin, ucsschool.lib.models.computer.SchoolComputer

Initializes a new instance with kwargs. Not every kwarg is accepted, though: The name must be defined as a attribute at class level (or by a base class). All attributes are initialized at least with None Sets self.old_dn to self.dn, i.e. the name in __init__ will determine the old_dn, changing it after __init__ will result in trying to move the object!

type_name = 'Mac OS X'
ucsschool_roles = <ucsschool.lib.models.attributes.Roles object>
default_roles = ['mac_computer']
class Meta[source]

Bases: ucsschool.lib.models.computer.Meta

udm_module = 'computers/macos'
hook_path = 'computer'
MacComputer._attributes = {'subnet_mask': <ucsschool.lib.models.attributes.SubnetMask object>, 'school': <ucsschool.lib.models.attributes.SchoolAttribute object>, 'inventory_number': <ucsschool.lib.models.attributes.InventoryNumber object>, 'name': <ucsschool.lib.models.attributes.CommonName object>, 'zone': <ucsschool.lib.models.attributes.Attribute object>, 'mac_address': <ucsschool.lib.models.attributes.MACAddress object>, 'ip_address': <ucsschool.lib.models.attributes.IPAddress object>, 'ucsschool_roles': <ucsschool.lib.models.attributes.Roles object>}
MacComputer._meta = <ucsschool.lib.models.meta.UCSSchoolHelperOptions object>
MacComputer.logger = <Proxy at 0x7fbbb08852d8 wrapping <celery.utils.log.ProcessAwareLogger object> at 0x7fbba7cca910 with factory <function <lambda>>>
class ucsschool.lib.models.computer.IPComputer(name=None, school=None, **kwargs)[source]

Bases: ucsschool.lib.models.base.RoleSupportMixin, ucsschool.lib.models.computer.SchoolComputer

Initializes a new instance with kwargs. Not every kwarg is accepted, though: The name must be defined as a attribute at class level (or by a base class). All attributes are initialized at least with None Sets self.old_dn to self.dn, i.e. the name in __init__ will determine the old_dn, changing it after __init__ will result in trying to move the object!

type_name = 'Device with IP address'
ucsschool_roles = <ucsschool.lib.models.attributes.Roles object>
default_roles = ['ip_computer']
class Meta[source]

Bases: ucsschool.lib.models.computer.Meta

udm_module = 'computers/ipmanagedclient'
hook_path = 'computer'
IPComputer._attributes = {'subnet_mask': <ucsschool.lib.models.attributes.SubnetMask object>, 'school': <ucsschool.lib.models.attributes.SchoolAttribute object>, 'inventory_number': <ucsschool.lib.models.attributes.InventoryNumber object>, 'name': <ucsschool.lib.models.attributes.CommonName object>, 'zone': <ucsschool.lib.models.attributes.Attribute object>, 'mac_address': <ucsschool.lib.models.attributes.MACAddress object>, 'ip_address': <ucsschool.lib.models.attributes.IPAddress object>, 'ucsschool_roles': <ucsschool.lib.models.attributes.Roles object>}
IPComputer._meta = <ucsschool.lib.models.meta.UCSSchoolHelperOptions object>
IPComputer.logger = <Proxy at 0x7fbbb0885320 wrapping <celery.utils.log.ProcessAwareLogger object> at 0x7fbba7cca910 with factory <function <lambda>>>
class ucsschool.lib.models.computer.UCCComputer(name=None, school=None, **kwargs)[source]

Bases: ucsschool.lib.models.computer.SchoolComputer

Initializes a new instance with kwargs. Not every kwarg is accepted, though: The name must be defined as a attribute at class level (or by a base class). All attributes are initialized at least with None Sets self.old_dn to self.dn, i.e. the name in __init__ will determine the old_dn, changing it after __init__ will result in trying to move the object!

type_name = 'Univention Corporate Client'
class Meta[source]

Bases: ucsschool.lib.models.computer.Meta

udm_module = 'computers/ucc'
hook_path = 'computer'
UCCComputer._attributes = {'subnet_mask': <ucsschool.lib.models.attributes.SubnetMask object>, 'school': <ucsschool.lib.models.attributes.SchoolAttribute object>, 'inventory_number': <ucsschool.lib.models.attributes.InventoryNumber object>, 'name': <ucsschool.lib.models.attributes.CommonName object>, 'zone': <ucsschool.lib.models.attributes.Attribute object>, 'mac_address': <ucsschool.lib.models.attributes.MACAddress object>, 'ip_address': <ucsschool.lib.models.attributes.IPAddress object>}
UCCComputer._meta = <ucsschool.lib.models.meta.UCSSchoolHelperOptions object>
UCCComputer.logger = <Proxy at 0x7fbbb0885368 wrapping <celery.utils.log.ProcessAwareLogger object> at 0x7fbba7cca910 with factory <function <lambda>>>

ucsschool.lib.models.dhcp module

class ucsschool.lib.models.dhcp.DHCPService(name=None, school=None, **kwargs)[source]

Bases: ucsschool.lib.models.base.UCSSchoolHelperAbstractClass

Initializes a new instance with kwargs. Not every kwarg is accepted, though: The name must be defined as a attribute at class level (or by a base class). All attributes are initialized at least with None Sets self.old_dn to self.dn, i.e. the name in __init__ will determine the old_dn, changing it after __init__ will result in trying to move the object!

name = <ucsschool.lib.models.attributes.DHCPServiceName object>
hostname = <ucsschool.lib.models.attributes.Attribute object>
domainname = <ucsschool.lib.models.attributes.Attribute object>
do_create(udm_obj, lo)[source]
classmethod get_container(school)[source]
add_server(dc_name, lo, force_dhcp_server_move=False)[source]

Create the given DHCP server within the DHCP service. If the DHCP server object already exists somewhere else within the LDAP tree, it may be moved to the DHCP service.

PLEASE NOTE: In multiserver environments an existing DHCP server object is always moved to the current DHCP service. In single server environments the DHCP server object is ONLY moved, if the UCR variable dhcpd/ldap/base matches to the current DHCP service.

get_servers(lo)[source]
class Meta[source]
udm_module = 'dhcp/service'
DHCPService._attributes = {'school': <ucsschool.lib.models.attributes.SchoolAttribute object>, 'hostname': <ucsschool.lib.models.attributes.Attribute object>, 'name': <ucsschool.lib.models.attributes.DHCPServiceName object>, 'domainname': <ucsschool.lib.models.attributes.Attribute object>}
DHCPService._meta = <ucsschool.lib.models.meta.UCSSchoolHelperOptions object>
DHCPService.logger = <Proxy at 0x7fbbaf9660e0 wrapping <celery.utils.log.ProcessAwareLogger object> at 0x7fbba7d9bcd0 with factory <function <lambda>>>
class ucsschool.lib.models.dhcp.AnyDHCPService(name=None, school=None, **kwargs)[source]

Bases: ucsschool.lib.models.dhcp.DHCPService

Initializes a new instance with kwargs. Not every kwarg is accepted, though: The name must be defined as a attribute at class level (or by a base class). All attributes are initialized at least with None Sets self.old_dn to self.dn, i.e. the name in __init__ will determine the old_dn, changing it after __init__ will result in trying to move the object!

school = None
classmethod get_container(school=None)[source]
get_servers(lo)[source]
_attributes = {'hostname': <ucsschool.lib.models.attributes.Attribute object>, 'name': <ucsschool.lib.models.attributes.DHCPServiceName object>, 'domainname': <ucsschool.lib.models.attributes.Attribute object>}
_meta = <ucsschool.lib.models.meta.UCSSchoolHelperOptions object>
logger = <Proxy at 0x7fbbaf966560 wrapping <celery.utils.log.ProcessAwareLogger object> at 0x7fbba7d9bcd0 with factory <function <lambda>>>
class ucsschool.lib.models.dhcp.DHCPServer(name=None, school=None, **kwargs)[source]

Bases: ucsschool.lib.models.base.UCSSchoolHelperAbstractClass

Initializes a new instance with kwargs. Not every kwarg is accepted, though: The name must be defined as a attribute at class level (or by a base class). All attributes are initialized at least with None Sets self.old_dn to self.dn, i.e. the name in __init__ will determine the old_dn, changing it after __init__ will result in trying to move the object!

name = <ucsschool.lib.models.attributes.DHCPServerName object>
dhcp_service = <ucsschool.lib.models.attributes.DHCPServiceAttribute object>
get_own_container()[source]
classmethod get_container(school)[source]
get_superordinate(lo)[source]
classmethod find_any_dn_with_name(name, lo)[source]
class Meta[source]
udm_module = 'dhcp/server'
name_is_unique = True
DHCPServer._attributes = {'school': <ucsschool.lib.models.attributes.SchoolAttribute object>, 'name': <ucsschool.lib.models.attributes.DHCPServerName object>, 'dhcp_service': <ucsschool.lib.models.attributes.DHCPServiceAttribute object>}
DHCPServer._meta = <ucsschool.lib.models.meta.UCSSchoolHelperOptions object>
DHCPServer.logger = <Proxy at 0x7fbbaf966638 wrapping <celery.utils.log.ProcessAwareLogger object> at 0x7fbba7d9bcd0 with factory <function <lambda>>>
class ucsschool.lib.models.dhcp.DHCPSubnet(name=None, school=None, **kwargs)[source]

Bases: ucsschool.lib.models.base.UCSSchoolHelperAbstractClass

Initializes a new instance with kwargs. Not every kwarg is accepted, though: The name must be defined as a attribute at class level (or by a base class). All attributes are initialized at least with None Sets self.old_dn to self.dn, i.e. the name in __init__ will determine the old_dn, changing it after __init__ will result in trying to move the object!

name = <ucsschool.lib.models.attributes.DHCPSubnetName object>
subnet_mask = <ucsschool.lib.models.attributes.DHCPSubnetMask object>
broadcast = <ucsschool.lib.models.attributes.BroadcastAddress object>
dhcp_service = <ucsschool.lib.models.attributes.DHCPServiceAttribute object>
get_own_container()[source]
classmethod get_container(school)[source]
get_superordinate(lo)[source]
get_ipv4_subnet()[source]
classmethod find_all_dns_below_base(dn, lo)[source]
class Meta[source]
udm_module = 'dhcp/subnet'
DHCPSubnet._attributes = {'broadcast': <ucsschool.lib.models.attributes.BroadcastAddress object>, 'subnet_mask': <ucsschool.lib.models.attributes.DHCPSubnetMask object>, 'school': <ucsschool.lib.models.attributes.SchoolAttribute object>, 'name': <ucsschool.lib.models.attributes.DHCPSubnetName object>, 'dhcp_service': <ucsschool.lib.models.attributes.DHCPServiceAttribute object>}
DHCPSubnet._meta = <ucsschool.lib.models.meta.UCSSchoolHelperOptions object>
DHCPSubnet.logger = <Proxy at 0x7fbbaf966368 wrapping <celery.utils.log.ProcessAwareLogger object> at 0x7fbba7d9bcd0 with factory <function <lambda>>>

ucsschool.lib.models.group module

class ucsschool.lib.models.group._MayHaveSchoolPrefix[source]

Bases: object

get_relative_name()[source]
get_replaced_name(school)[source]
class ucsschool.lib.models.group._MayHaveSchoolSuffix[source]

Bases: object

get_relative_name()[source]
get_replaced_name(school)[source]
class ucsschool.lib.models.group.Group(name=None, school=None, **kwargs)[source]

Bases: ucsschool.lib.models.base.RoleSupportMixin, ucsschool.lib.models.base.UCSSchoolHelperAbstractClass

Initializes a new instance with kwargs. Not every kwarg is accepted, though: The name must be defined as a attribute at class level (or by a base class). All attributes are initialized at least with None Sets self.old_dn to self.dn, i.e. the name in __init__ will determine the old_dn, changing it after __init__ will result in trying to move the object!

name = <ucsschool.lib.models.attributes.GroupName object>
description = <ucsschool.lib.models.attributes.Description object>
users = <ucsschool.lib.models.attributes.Users object>
ucsschool_roles = <ucsschool.lib.models.attributes.Roles object>
classmethod get_container(school)[source]
classmethod is_school_group(school, group_dn)[source]
classmethod is_school_workgroup(school, group_dn)[source]
classmethod is_school_class(school, group_dn)[source]
classmethod is_computer_room(school, group_dn)[source]
self_is_workgroup()[source]
self_is_class()[source]
self_is_computerroom()[source]
classmethod get_class_for_udm_obj(udm_obj, school)[source]
add_umc_policy(policy_dn, lo)[source]
build_hook_line(hook_time, func_name)[source]
class Meta[source]
udm_module = 'groups/group'
name_is_unique = True
Group._attributes = {'school': <ucsschool.lib.models.attributes.SchoolAttribute object>, 'description': <ucsschool.lib.models.attributes.Description object>, 'name': <ucsschool.lib.models.attributes.GroupName object>, 'ucsschool_roles': <ucsschool.lib.models.attributes.Roles object>, 'users': <ucsschool.lib.models.attributes.Users object>}
Group._meta = <ucsschool.lib.models.meta.UCSSchoolHelperOptions object>
Group.logger = <Proxy at 0x7fbbaf95b7e8 wrapping <celery.utils.log.ProcessAwareLogger object> at 0x7fbbb06ead90 with factory <function <lambda>>>
class ucsschool.lib.models.group.BasicGroup(name=None, school=None, **kwargs)[source]

Bases: ucsschool.lib.models.group.Group

school = None
container = <ucsschool.lib.models.attributes.Attribute object>
create_without_hooks(lo, validate)[source]
get_own_container()[source]
build_hook_line(hook_time, func_name)[source]
classmethod get_container(school=None)[source]
_attributes = {'container': <ucsschool.lib.models.attributes.Attribute object>, 'users': <ucsschool.lib.models.attributes.Users object>, 'ucsschool_roles': <ucsschool.lib.models.attributes.Roles object>, 'name': <ucsschool.lib.models.attributes.GroupName object>, 'description': <ucsschool.lib.models.attributes.Description object>}
_meta = <ucsschool.lib.models.meta.UCSSchoolHelperOptions object>
logger = <Proxy at 0x7fbbaf95b8c0 wrapping <celery.utils.log.ProcessAwareLogger object> at 0x7fbbb06ead90 with factory <function <lambda>>>
class ucsschool.lib.models.group.BasicSchoolGroup(name=None, school=None, **kwargs)[source]

Bases: ucsschool.lib.models.group.BasicGroup

school = <ucsschool.lib.models.attributes.SchoolAttribute object>
_attributes = {'school': <ucsschool.lib.models.attributes.SchoolAttribute object>, 'container': <ucsschool.lib.models.attributes.Attribute object>, 'description': <ucsschool.lib.models.attributes.Description object>, 'ucsschool_roles': <ucsschool.lib.models.attributes.Roles object>, 'name': <ucsschool.lib.models.attributes.GroupName object>, 'users': <ucsschool.lib.models.attributes.Users object>}
_meta = <ucsschool.lib.models.meta.UCSSchoolHelperOptions object>
logger = <Proxy at 0x7fbbaf95bab8 wrapping <celery.utils.log.ProcessAwareLogger object> at 0x7fbbb06ead90 with factory <function <lambda>>>
class ucsschool.lib.models.group.SchoolGroup(name=None, school=None, **kwargs)[source]

Bases: ucsschool.lib.models.group.Group, ucsschool.lib.models.group._MayHaveSchoolSuffix

Initializes a new instance with kwargs. Not every kwarg is accepted, though: The name must be defined as a attribute at class level (or by a base class). All attributes are initialized at least with None Sets self.old_dn to self.dn, i.e. the name in __init__ will determine the old_dn, changing it after __init__ will result in trying to move the object!

_attributes = {'users': <ucsschool.lib.models.attributes.Users object>, 'school': <ucsschool.lib.models.attributes.SchoolAttribute object>, 'description': <ucsschool.lib.models.attributes.Description object>, 'ucsschool_roles': <ucsschool.lib.models.attributes.Roles object>, 'name': <ucsschool.lib.models.attributes.GroupName object>}
_meta = <ucsschool.lib.models.meta.UCSSchoolHelperOptions object>
logger = <Proxy at 0x7fbbaf95bf80 wrapping <celery.utils.log.ProcessAwareLogger object> at 0x7fbbb06ead90 with factory <function <lambda>>>
class ucsschool.lib.models.group.SchoolClass(name=None, school=None, **kwargs)[source]

Bases: ucsschool.lib.models.group.Group, ucsschool.lib.models.group._MayHaveSchoolPrefix

Initializes a new instance with kwargs. Not every kwarg is accepted, though: The name must be defined as a attribute at class level (or by a base class). All attributes are initialized at least with None Sets self.old_dn to self.dn, i.e. the name in __init__ will determine the old_dn, changing it after __init__ will result in trying to move the object!

name = <ucsschool.lib.models.attributes.SchoolClassName object>
default_roles = ['school_class']
_school_in_name_prefix = True
ShareClass

alias of ClassShare

create_without_hooks(lo, validate)[source]
create_share(lo)[source]
modify_without_hooks(lo, validate=True, move_if_necessary=None)[source]
remove_without_hooks(lo)[source]
classmethod get_container(school)[source]
to_dict()[source]
classmethod get_class_for_udm_obj(udm_obj, school)[source]
_attributes = {'users': <ucsschool.lib.models.attributes.Users object>, 'school': <ucsschool.lib.models.attributes.SchoolAttribute object>, 'description': <ucsschool.lib.models.attributes.Description object>, 'ucsschool_roles': <ucsschool.lib.models.attributes.Roles object>, 'name': <ucsschool.lib.models.attributes.SchoolClassName object>}
_meta = <ucsschool.lib.models.meta.UCSSchoolHelperOptions object>
logger = <Proxy at 0x7fbbaf95be18 wrapping <celery.utils.log.ProcessAwareLogger object> at 0x7fbbb06ead90 with factory <function <lambda>>>
class ucsschool.lib.models.group.WorkGroup(name=None, school=None, **kwargs)[source]

Bases: ucsschool.lib.models.group.SchoolClass, ucsschool.lib.models.group._MayHaveSchoolPrefix

Initializes a new instance with kwargs. Not every kwarg is accepted, though: The name must be defined as a attribute at class level (or by a base class). All attributes are initialized at least with None Sets self.old_dn to self.dn, i.e. the name in __init__ will determine the old_dn, changing it after __init__ will result in trying to move the object!

default_roles = ['workgroup']
ShareClass

alias of WorkGroupShare

classmethod get_container(school)[source]
build_hook_line(hook_time, func_name)[source]
classmethod get_class_for_udm_obj(udm_obj, school)[source]
_attributes = {'name': <ucsschool.lib.models.attributes.SchoolClassName object>, 'school': <ucsschool.lib.models.attributes.SchoolAttribute object>, 'users': <ucsschool.lib.models.attributes.Users object>, 'ucsschool_roles': <ucsschool.lib.models.attributes.Roles object>, 'description': <ucsschool.lib.models.attributes.Description object>}
_meta = <ucsschool.lib.models.meta.UCSSchoolHelperOptions object>
logger = <Proxy at 0x7fbbaf95bc68 wrapping <celery.utils.log.ProcessAwareLogger object> at 0x7fbbb06ead90 with factory <function <lambda>>>
class ucsschool.lib.models.group.ComputerRoom(name=None, school=None, **kwargs)[source]

Bases: ucsschool.lib.models.group.Group, ucsschool.lib.models.group._MayHaveSchoolPrefix

Initializes a new instance with kwargs. Not every kwarg is accepted, though: The name must be defined as a attribute at class level (or by a base class). All attributes are initialized at least with None Sets self.old_dn to self.dn, i.e. the name in __init__ will determine the old_dn, changing it after __init__ will result in trying to move the object!

hosts = <ucsschool.lib.models.attributes.Hosts object>
users = None
default_roles = ['computer_room']
to_dict()[source]
classmethod get_container(school)[source]
get_computers(ldap_connection)[source]
get_schools_from_udm_obj(udm_obj)[source]
_attributes = {'school': <ucsschool.lib.models.attributes.SchoolAttribute object>, 'description': <ucsschool.lib.models.attributes.Description object>, 'ucsschool_roles': <ucsschool.lib.models.attributes.Roles object>, 'hosts': <ucsschool.lib.models.attributes.Hosts object>, 'name': <ucsschool.lib.models.attributes.GroupName object>}
_meta = <ucsschool.lib.models.meta.UCSSchoolHelperOptions object>
logger = <Proxy at 0x7fbbaf95ba70 wrapping <celery.utils.log.ProcessAwareLogger object> at 0x7fbbb06ead90 with factory <function <lambda>>>

ucsschool.lib.models.meta module

class ucsschool.lib.models.meta.UCSSchoolHelperOptions(klass, meta=None)[source]

Bases: object

set_from_meta_object(meta, name, default)[source]
class ucsschool.lib.models.meta.UCSSchoolHelperMetaClass[source]

Bases: type

ucsschool.lib.models.misc module

class ucsschool.lib.models.misc.MailDomain(name=None, school=None, **kwargs)[source]

Bases: ucsschool.lib.models.base.UCSSchoolHelperAbstractClass

Initializes a new instance with kwargs. Not every kwarg is accepted, though: The name must be defined as a attribute at class level (or by a base class). All attributes are initialized at least with None Sets self.old_dn to self.dn, i.e. the name in __init__ will determine the old_dn, changing it after __init__ will result in trying to move the object!

school = None
classmethod get_container(school=None)[source]
class Meta[source]
udm_module = 'mail/domain'
MailDomain._attributes = {'name': <ucsschool.lib.models.attributes.CommonName object>}
MailDomain._meta = <ucsschool.lib.models.meta.UCSSchoolHelperOptions object>
MailDomain.logger = <Proxy at 0x7fbbafcfe3b0 wrapping <celery.utils.log.ProcessAwareLogger object> at 0x7fbba92aa7d0 with factory <function <lambda>>>
class ucsschool.lib.models.misc.OU(name=None, school=None, **kwargs)[source]

Bases: ucsschool.lib.models.base.UCSSchoolHelperAbstractClass

Initializes a new instance with kwargs. Not every kwarg is accepted, though: The name must be defined as a attribute at class level (or by a base class). All attributes are initialized at least with None Sets self.old_dn to self.dn, i.e. the name in __init__ will determine the old_dn, changing it after __init__ will result in trying to move the object!

create(lo, validate=True)[source]
modify(lo, validate=True, move_if_necessary=None)[source]
remove(lo)[source]
classmethod get_container(school)[source]
class Meta[source]
udm_module = 'container/ou'
OU._attributes = {'school': <ucsschool.lib.models.attributes.SchoolAttribute object>, 'name': <ucsschool.lib.models.attributes.CommonName object>}
OU._meta = <ucsschool.lib.models.meta.UCSSchoolHelperOptions object>
OU.logger = <Proxy at 0x7fbbafcfeb00 wrapping <celery.utils.log.ProcessAwareLogger object> at 0x7fbba92aa7d0 with factory <function <lambda>>>
class ucsschool.lib.models.misc.Container(name=None, school=None, **kwargs)[source]

Bases: ucsschool.lib.models.misc.OU

Initializes a new instance with kwargs. Not every kwarg is accepted, though: The name must be defined as a attribute at class level (or by a base class). All attributes are initialized at least with None Sets self.old_dn to self.dn, i.e. the name in __init__ will determine the old_dn, changing it after __init__ will result in trying to move the object!

user_path = <ucsschool.lib.models.attributes.ContainerPath object>
computer_path = <ucsschool.lib.models.attributes.ContainerPath object>
network_path = <ucsschool.lib.models.attributes.ContainerPath object>
group_path = <ucsschool.lib.models.attributes.ContainerPath object>
dhcp_path = <ucsschool.lib.models.attributes.ContainerPath object>
policy_path = <ucsschool.lib.models.attributes.ContainerPath object>
share_path = <ucsschool.lib.models.attributes.ContainerPath object>
printer_path = <ucsschool.lib.models.attributes.ContainerPath object>
class Meta[source]
udm_module = 'container/cn'
Container._attributes = {'school': <ucsschool.lib.models.attributes.SchoolAttribute object>, 'policy_path': <ucsschool.lib.models.attributes.ContainerPath object>, 'name': <ucsschool.lib.models.attributes.CommonName object>, 'user_path': <ucsschool.lib.models.attributes.ContainerPath object>, 'printer_path': <ucsschool.lib.models.attributes.ContainerPath object>, 'computer_path': <ucsschool.lib.models.attributes.ContainerPath object>, 'network_path': <ucsschool.lib.models.attributes.ContainerPath object>, 'share_path': <ucsschool.lib.models.attributes.ContainerPath object>, 'group_path': <ucsschool.lib.models.attributes.ContainerPath object>, 'dhcp_path': <ucsschool.lib.models.attributes.ContainerPath object>}
Container._meta = <ucsschool.lib.models.meta.UCSSchoolHelperOptions object>
Container.logger = <Proxy at 0x7fbbafcfe950 wrapping <celery.utils.log.ProcessAwareLogger object> at 0x7fbba92aa7d0 with factory <function <lambda>>>

ucsschool.lib.models.network module

class ucsschool.lib.models.network.Network(name=None, school=None, **kwargs)[source]

Bases: ucsschool.lib.models.base.UCSSchoolHelperAbstractClass

Initializes a new instance with kwargs. Not every kwarg is accepted, though: The name must be defined as a attribute at class level (or by a base class). All attributes are initialized at least with None Sets self.old_dn to self.dn, i.e. the name in __init__ will determine the old_dn, changing it after __init__ will result in trying to move the object!

netmask = <ucsschool.lib.models.attributes.Netmask object>
network = <ucsschool.lib.models.attributes.NetworkAttribute object>
broadcast = <ucsschool.lib.models.attributes.NetworkBroadcastAddress object>
_netmask_cache = {}
classmethod get_container(school)[source]
get_subnet()[source]
create_without_hooks(lo, validate)[source]
do_create(udm_obj, lo)[source]
classmethod invalidate_cache()[source]
classmethod get_netmask(dn, school, lo)[source]
class Meta[source]
udm_module = 'networks/network'
Network._attributes = {'broadcast': <ucsschool.lib.models.attributes.NetworkBroadcastAddress object>, 'school': <ucsschool.lib.models.attributes.SchoolAttribute object>, 'netmask': <ucsschool.lib.models.attributes.Netmask object>, 'name': <ucsschool.lib.models.attributes.CommonName object>, 'network': <ucsschool.lib.models.attributes.NetworkAttribute object>}
Network._meta = <ucsschool.lib.models.meta.UCSSchoolHelperOptions object>
Network.logger = <Proxy at 0x7fbbb0885128 wrapping <celery.utils.log.ProcessAwareLogger object> at 0x7fbba9ccedd0 with factory <function <lambda>>>
class ucsschool.lib.models.network.DNSReverseZone(name=None, school=None, **kwargs)[source]

Bases: ucsschool.lib.models.base.UCSSchoolHelperAbstractClass

Initializes a new instance with kwargs. Not every kwarg is accepted, though: The name must be defined as a attribute at class level (or by a base class). All attributes are initialized at least with None Sets self.old_dn to self.dn, i.e. the name in __init__ will determine the old_dn, changing it after __init__ will result in trying to move the object!

name = <ucsschool.lib.models.attributes.SubnetName object>
school = None
classmethod get_container(school=None)[source]
do_create(udm_obj, lo)[source]
class Meta[source]
udm_module = 'dns/reverse_zone'
DNSReverseZone._attributes = {'name': <ucsschool.lib.models.attributes.SubnetName object>}
DNSReverseZone._meta = <ucsschool.lib.models.meta.UCSSchoolHelperOptions object>
DNSReverseZone.logger = <Proxy at 0x7fbbb0885170 wrapping <celery.utils.log.ProcessAwareLogger object> at 0x7fbba9ccedd0 with factory <function <lambda>>>

ucsschool.lib.models.policy module

class ucsschool.lib.models.policy.Policy(name=None, school=None, **kwargs)[source]

Bases: ucsschool.lib.models.base.UCSSchoolHelperAbstractClass

Initializes a new instance with kwargs. Not every kwarg is accepted, though: The name must be defined as a attribute at class level (or by a base class). All attributes are initialized at least with None Sets self.old_dn to self.dn, i.e. the name in __init__ will determine the old_dn, changing it after __init__ will result in trying to move the object!

classmethod get_container(school)[source]
attach(obj, lo)[source]
_attributes = {'school': <ucsschool.lib.models.attributes.SchoolAttribute object>, 'name': <ucsschool.lib.models.attributes.CommonName object>}
_meta = <ucsschool.lib.models.meta.UCSSchoolHelperOptions object>
logger = <Proxy at 0x7fbbafcdba70 wrapping <celery.utils.log.ProcessAwareLogger object> at 0x7fbba98f0e90 with factory <function <lambda>>>
class ucsschool.lib.models.policy.UMCPolicy(name=None, school=None, **kwargs)[source]

Bases: ucsschool.lib.models.policy.Policy

Initializes a new instance with kwargs. Not every kwarg is accepted, though: The name must be defined as a attribute at class level (or by a base class). All attributes are initialized at least with None Sets self.old_dn to self.dn, i.e. the name in __init__ will determine the old_dn, changing it after __init__ will result in trying to move the object!

class Meta[source]
udm_module = 'policies/umc'
UMCPolicy._attributes = {'school': <ucsschool.lib.models.attributes.SchoolAttribute object>, 'name': <ucsschool.lib.models.attributes.CommonName object>}
UMCPolicy._meta = <ucsschool.lib.models.meta.UCSSchoolHelperOptions object>
UMCPolicy.logger = <Proxy at 0x7fbbaf95bb00 wrapping <celery.utils.log.ProcessAwareLogger object> at 0x7fbba98f0e90 with factory <function <lambda>>>
class ucsschool.lib.models.policy.DHCPDNSPolicy(name=None, school=None, **kwargs)[source]

Bases: ucsschool.lib.models.policy.Policy

Initializes a new instance with kwargs. Not every kwarg is accepted, though: The name must be defined as a attribute at class level (or by a base class). All attributes are initialized at least with None Sets self.old_dn to self.dn, i.e. the name in __init__ will determine the old_dn, changing it after __init__ will result in trying to move the object!

empty_attributes = <ucsschool.lib.models.attributes.EmptyAttributes object>
class Meta[source]
udm_module = 'policies/dhcp_dns'
DHCPDNSPolicy._attributes = {'school': <ucsschool.lib.models.attributes.SchoolAttribute object>, 'name': <ucsschool.lib.models.attributes.CommonName object>, 'empty_attributes': <ucsschool.lib.models.attributes.EmptyAttributes object>}
DHCPDNSPolicy._meta = <ucsschool.lib.models.meta.UCSSchoolHelperOptions object>
DHCPDNSPolicy.logger = <Proxy at 0x7fbbaf95b878 wrapping <celery.utils.log.ProcessAwareLogger object> at 0x7fbba98f0e90 with factory <function <lambda>>>

ucsschool.lib.models.school module

class ucsschool.lib.models.school.School(name=None, school=None, alter_dhcpd_base=None, **kwargs)[source]

Bases: ucsschool.lib.models.base.RoleSupportMixin, ucsschool.lib.models.base.UCSSchoolHelperAbstractClass

name = <ucsschool.lib.models.attributes.SchoolName object>
dc_name = <ucsschool.lib.models.attributes.DCName object>
dc_name_administrative = <ucsschool.lib.models.attributes.DCName object>
class_share_file_server = <ucsschool.lib.models.attributes.ShareFileServer object>
home_share_file_server = <ucsschool.lib.models.attributes.ShareFileServer object>
school = None
educational_servers = <ucsschool.lib.models.attributes.Attribute object>
administrative_servers = <ucsschool.lib.models.attributes.Attribute object>
ucsschool_roles = <ucsschool.lib.models.attributes.Roles object>
default_roles = ['school']
_school_in_name = True
display_name = <ucsschool.lib.models.attributes.DisplayName object>
validate(lo, validate_unlikely_changes=False)[source]
build_hook_line(hook_time, func_name)[source]
get_district()[source]
get_own_container()[source]
classmethod get_container(school=None)[source]
classmethod cn_name(name, default)[source]
create_default_containers(lo)[source]
group_name(prefix_var, default_prefix)[source]
get_umc_policy_dn(name)[source]
create_default_groups(lo)[source]
get_dc_name_fallback(administrative=False)[source]
get_dc_name(administrative=False)[source]
get_share_fileserver_dn(set_by_self, lo)[source]
get_class_share_file_server(lo)[source]
get_home_share_file_server(lo)[source]
get_administrative_group_name(group_type, domain_controller=True, ou_specific=False, as_dn=False)[source]
get_administrative_server_names(lo)[source]
get_educational_server_names(lo)[source]
add_host_to_dc_group(lo)[source]
shall_create_administrative_objects()[source]
create_dc_slave(lo, name, administrative=False)[source]
add_domain_controllers(lo)[source]
get_dhcp_service(hostname=None)[source]
create_without_hooks(lo, validate)[source]
get_schools()[source]
_alter_udm_obj(udm_obj)[source]
classmethod from_binddn(lo)[source]
classmethod from_udm_obj(udm_obj, school, lo)[source]
classmethod get_all(lo, filter_str=None, easy_filter=False, respect_local_oulist=True)[source]
classmethod _filter_local_schools(schools, lo)[source]
classmethod _attrs_for_easy_filter()[source]
classmethod invalidate_cache()[source]
class Meta[source]
udm_module = 'container/ou'
udm_filter = 'objectClass=ucsschoolOrganizationalUnit'
School._attributes = {'dc_name': <ucsschool.lib.models.attributes.DCName object>, 'display_name': <ucsschool.lib.models.attributes.DisplayName object>, 'name': <ucsschool.lib.models.attributes.SchoolName object>, 'class_share_file_server': <ucsschool.lib.models.attributes.ShareFileServer object>, 'administrative_servers': <ucsschool.lib.models.attributes.Attribute object>, 'ucsschool_roles': <ucsschool.lib.models.attributes.Roles object>, 'home_share_file_server': <ucsschool.lib.models.attributes.ShareFileServer object>, 'dc_name_administrative': <ucsschool.lib.models.attributes.DCName object>, 'educational_servers': <ucsschool.lib.models.attributes.Attribute object>}
School._meta = <ucsschool.lib.models.meta.UCSSchoolHelperOptions object>
School.logger = <Proxy at 0x7fbbb0882b90 wrapping <celery.utils.log.ProcessAwareLogger object> at 0x7fbba78d19d0 with factory <function <lambda>>>

ucsschool.lib.models.share module

class ucsschool.lib.models.share.Share(name=None, school=None, **kwargs)[source]

Bases: ucsschool.lib.models.base.UCSSchoolHelperAbstractClass

Initializes a new instance with kwargs. Not every kwarg is accepted, though: The name must be defined as a attribute at class level (or by a base class). All attributes are initialized at least with None Sets self.old_dn to self.dn, i.e. the name in __init__ will determine the old_dn, changing it after __init__ will result in trying to move the object!

name = <ucsschool.lib.models.attributes.ShareName object>
school_group = <ucsschool.lib.models.attributes.SchoolClassAttribute object>
classmethod from_school_group(school_group)[source]
classmethod from_school_class(school_group)
classmethod get_container(school)[source]
do_create(udm_obj, lo)[source]
get_share_path()[source]
do_modify(udm_obj, lo)[source]
get_server_fqdn(lo)[source]
class Meta[source]
udm_module = 'shares/share'
Share._attributes = {'school': <ucsschool.lib.models.attributes.SchoolAttribute object>, 'school_group': <ucsschool.lib.models.attributes.SchoolClassAttribute object>, 'name': <ucsschool.lib.models.attributes.ShareName object>}
Share._meta = <ucsschool.lib.models.meta.UCSSchoolHelperOptions object>
Share.logger = <Proxy at 0x7fbbafcfe518 wrapping <celery.utils.log.ProcessAwareLogger object> at 0x7fbba884bbd0 with factory <function <lambda>>>
class ucsschool.lib.models.share.WorkGroupShare(name=None, school=None, **kwargs)[source]

Bases: ucsschool.lib.models.base.RoleSupportMixin, ucsschool.lib.models.share.Share

Initializes a new instance with kwargs. Not every kwarg is accepted, though: The name must be defined as a attribute at class level (or by a base class). All attributes are initialized at least with None Sets self.old_dn to self.dn, i.e. the name in __init__ will determine the old_dn, changing it after __init__ will result in trying to move the object!

ucsschool_roles = <ucsschool.lib.models.attributes.Roles object>
default_roles = ['workgroup_share']
_school_in_name_prefix = True

This method was overwritten to identify WorkGroupShares and distinct them from other shares of the school. If at some point a lookup is implemented that uses the role attribute which is reliable this code can be removed. Bug #48428

classmethod get_all(lo, school, filter_str=None, easy_filter=False, superordinate=None)[source]
_attributes = {'school': <ucsschool.lib.models.attributes.SchoolAttribute object>, 'school_group': <ucsschool.lib.models.attributes.SchoolClassAttribute object>, 'name': <ucsschool.lib.models.attributes.ShareName object>, 'ucsschool_roles': <ucsschool.lib.models.attributes.Roles object>}
_meta = <ucsschool.lib.models.meta.UCSSchoolHelperOptions object>
logger = <Proxy at 0x7fbbaf950a70 wrapping <celery.utils.log.ProcessAwareLogger object> at 0x7fbba884bbd0 with factory <function <lambda>>>
class ucsschool.lib.models.share.ClassShare(name=None, school=None, **kwargs)[source]

Bases: ucsschool.lib.models.base.RoleSupportMixin, ucsschool.lib.models.share.Share

Initializes a new instance with kwargs. Not every kwarg is accepted, though: The name must be defined as a attribute at class level (or by a base class). All attributes are initialized at least with None Sets self.old_dn to self.dn, i.e. the name in __init__ will determine the old_dn, changing it after __init__ will result in trying to move the object!

ucsschool_roles = <ucsschool.lib.models.attributes.Roles object>
default_roles = ['school_class_share']
_school_in_name_prefix = True
classmethod get_container(school)[source]
_attributes = {'school': <ucsschool.lib.models.attributes.SchoolAttribute object>, 'school_group': <ucsschool.lib.models.attributes.SchoolClassAttribute object>, 'name': <ucsschool.lib.models.attributes.ShareName object>, 'ucsschool_roles': <ucsschool.lib.models.attributes.Roles object>}
_meta = <ucsschool.lib.models.meta.UCSSchoolHelperOptions object>
get_share_path()[source]
logger = <Proxy at 0x7fbbaf95bb48 wrapping <celery.utils.log.ProcessAwareLogger object> at 0x7fbba884bbd0 with factory <function <lambda>>>

ucsschool.lib.models.user module

class ucsschool.lib.models.user.User(*args, **kwargs)[source]

Bases: ucsschool.lib.models.base.RoleSupportMixin, ucsschool.lib.models.base.UCSSchoolHelperAbstractClass

name = <ucsschool.lib.models.attributes.Username object>
schools = <ucsschool.lib.models.attributes.Schools object>
firstname = <ucsschool.lib.models.attributes.Firstname object>
lastname = <ucsschool.lib.models.attributes.Lastname object>
birthday = <ucsschool.lib.models.attributes.Birthday object>
email = <ucsschool.lib.models.attributes.Email object>
password = <ucsschool.lib.models.attributes.Password object>
disabled = <ucsschool.lib.models.attributes.Disabled object>
ucsschool_roles = <ucsschool.lib.models.attributes.Roles object>
type_name = None
type_filter = '(|(objectClass=ucsschoolTeacher)(objectClass=ucsschoolStaff)(objectClass=ucsschoolStudent))'
_profile_path_cache = {}
_samba_home_path_cache = {}
roles = []
default_roles = []
default_options = ()
school_classes = <ucsschool.lib.models.attributes.SchoolClassesAttribute object>
classmethod shall_create_mail_domain()[source]
get_roleshare_home_subdir()[source]
get_samba_home_drive()[source]
get_samba_netlogon_script_path()[source]
get_samba_home_path(lo)[source]
get_profile_path(lo)[source]
is_student(lo)[source]
is_exam_student(lo)[source]
is_teacher(lo)[source]
is_staff(lo)[source]
is_administrator(lo)[source]
classmethod _legacy_is_student(school, dn)[source]
classmethod _legacy_is_exam_student(school, dn)[source]
classmethod _legacy_is_teacher(school, dn)[source]
classmethod _legacy_is_staff(school, dn)[source]
classmethod _legacy_is_admininstrator(school, dn)[source]
classmethod get_class_for_udm_obj(udm_obj, school)[source]
classmethod from_udm_obj(udm_obj, school, lo)[source]
do_create(udm_obj, lo)[source]
do_modify(udm_obj, lo)[source]
do_school_change(udm_obj, lo, old_school)[source]
_alter_udm_obj(udm_obj)[source]
get_mail_domain()[source]
create_mail_domain(lo)[source]
set_default_options(udm_obj)[source]
classmethod get_default_options()[source]
get_specific_groups(lo)[source]
validate(lo, validate_unlikely_changes=False)[source]
remove_from_school(school, lo)[source]
remove_from_groups_of_school(school, lo)[source]
get_group_dn(group_name, school)[source]
get_class_dn(class_name, school, lo)[source]
primary_group_dn(lo)[source]
get_domain_users_groups()[source]
get_students_groups()[source]
get_teachers_groups()[source]
get_staff_groups()[source]
groups_used(lo)[source]
classmethod get_or_create_group_udm_object(group_dn, lo, fresh=False)[source]
is_active()[source]
build_hook_line(hook_time, func_name)[source]
to_dict()[source]
get_school_class_objs()[source]
classmethod get_school_classes(udm_obj, obj)[source]
classmethod get_container(school)[source]
classmethod lookup(lo, school, filter_s='', superordinate=None)[source]
class Meta[source]
udm_module = 'users/user'
name_is_unique = True
allow_school_change = False
User._User__check_object_class(lo, object_class, fallback)
User._attributes = {'school': <ucsschool.lib.models.attributes.SchoolAttribute object>, 'name': <ucsschool.lib.models.attributes.Username object>, 'firstname': <ucsschool.lib.models.attributes.Firstname object>, 'lastname': <ucsschool.lib.models.attributes.Lastname object>, 'ucsschool_roles': <ucsschool.lib.models.attributes.Roles object>, 'school_classes': <ucsschool.lib.models.attributes.SchoolClassesAttribute object>, 'disabled': <ucsschool.lib.models.attributes.Disabled object>, 'birthday': <ucsschool.lib.models.attributes.Birthday object>, 'schools': <ucsschool.lib.models.attributes.Schools object>, 'password': <ucsschool.lib.models.attributes.Password object>, 'email': <ucsschool.lib.models.attributes.Email object>}
User._meta = <ucsschool.lib.models.meta.UCSSchoolHelperOptions object>
User.logger = <Proxy at 0x7fbbafcfe050 wrapping <celery.utils.log.ProcessAwareLogger object> at 0x7fbba7520410 with factory <function <lambda>>>
class ucsschool.lib.models.user.Student(*args, **kwargs)[source]

Bases: ucsschool.lib.models.user.User

type_name = 'Student'
type_filter = '(&(objectClass=ucsschoolStudent)(!(objectClass=ucsschoolExam)))'
roles = ['pupil']
default_options = ('ucsschoolStudent',)
default_roles = ['student']
do_school_change(udm_obj, lo, old_school)[source]
classmethod get_container(school)[source]
classmethod get_exam_container(school)[source]
get_specific_groups(lo)[source]
_attributes = {'school': <ucsschool.lib.models.attributes.SchoolAttribute object>, 'name': <ucsschool.lib.models.attributes.Username object>, 'firstname': <ucsschool.lib.models.attributes.Firstname object>, 'lastname': <ucsschool.lib.models.attributes.Lastname object>, 'ucsschool_roles': <ucsschool.lib.models.attributes.Roles object>, 'school_classes': <ucsschool.lib.models.attributes.SchoolClassesAttribute object>, 'disabled': <ucsschool.lib.models.attributes.Disabled object>, 'birthday': <ucsschool.lib.models.attributes.Birthday object>, 'schools': <ucsschool.lib.models.attributes.Schools object>, 'password': <ucsschool.lib.models.attributes.Password object>, 'email': <ucsschool.lib.models.attributes.Email object>}
_meta = <ucsschool.lib.models.meta.UCSSchoolHelperOptions object>
logger = <Proxy at 0x7fbbb087d560 wrapping <celery.utils.log.ProcessAwareLogger object> at 0x7fbba7520410 with factory <function <lambda>>>
class ucsschool.lib.models.user.Teacher(*args, **kwargs)[source]

Bases: ucsschool.lib.models.user.User

type_name = 'Teacher'
type_filter = '(&(objectClass=ucsschoolTeacher)(!(objectClass=ucsschoolStaff)))'
roles = ['teacher']
default_roles = ['teacher']
default_options = ('ucsschoolTeacher',)
classmethod get_container(school)[source]
get_specific_groups(lo)[source]
_attributes = {'school': <ucsschool.lib.models.attributes.SchoolAttribute object>, 'name': <ucsschool.lib.models.attributes.Username object>, 'firstname': <ucsschool.lib.models.attributes.Firstname object>, 'lastname': <ucsschool.lib.models.attributes.Lastname object>, 'ucsschool_roles': <ucsschool.lib.models.attributes.Roles object>, 'school_classes': <ucsschool.lib.models.attributes.SchoolClassesAttribute object>, 'disabled': <ucsschool.lib.models.attributes.Disabled object>, 'birthday': <ucsschool.lib.models.attributes.Birthday object>, 'schools': <ucsschool.lib.models.attributes.Schools object>, 'password': <ucsschool.lib.models.attributes.Password object>, 'email': <ucsschool.lib.models.attributes.Email object>}
_meta = <ucsschool.lib.models.meta.UCSSchoolHelperOptions object>
logger = <Proxy at 0x7fbbb087d518 wrapping <celery.utils.log.ProcessAwareLogger object> at 0x7fbba7520410 with factory <function <lambda>>>
class ucsschool.lib.models.user.Staff(*args, **kwargs)[source]

Bases: ucsschool.lib.models.user.User

school_classes = None
type_name = 'Staff'
roles = ['staff']
default_roles = ['staff']
type_filter = '(&(!(objectClass=ucsschoolTeacher))(objectClass=ucsschoolStaff))'
default_options = ('ucsschoolStaff',)
classmethod get_container(school)[source]
get_samba_home_path(lo)[source]

Do not set sambaHomePath for staff users.

get_samba_home_drive()[source]

Do not set sambaHomeDrive for staff users.

get_samba_netlogon_script_path()[source]

Do not set sambaLogonScript for staff users.

get_profile_path(lo)[source]

Do not set sambaProfilePath for staff users.

get_school_class_objs()[source]
classmethod get_school_classes(udm_obj, obj)[source]
get_specific_groups(lo)[source]
_attributes = {'school': <ucsschool.lib.models.attributes.SchoolAttribute object>, 'name': <ucsschool.lib.models.attributes.Username object>, 'firstname': <ucsschool.lib.models.attributes.Firstname object>, 'lastname': <ucsschool.lib.models.attributes.Lastname object>, 'ucsschool_roles': <ucsschool.lib.models.attributes.Roles object>, 'disabled': <ucsschool.lib.models.attributes.Disabled object>, 'birthday': <ucsschool.lib.models.attributes.Birthday object>, 'schools': <ucsschool.lib.models.attributes.Schools object>, 'password': <ucsschool.lib.models.attributes.Password object>, 'email': <ucsschool.lib.models.attributes.Email object>}
_meta = <ucsschool.lib.models.meta.UCSSchoolHelperOptions object>
logger = <Proxy at 0x7fbbb087d440 wrapping <celery.utils.log.ProcessAwareLogger object> at 0x7fbba7520410 with factory <function <lambda>>>
class ucsschool.lib.models.user.TeachersAndStaff(*args, **kwargs)[source]

Bases: ucsschool.lib.models.user.Teacher

type_name = 'Teacher and Staff'
type_filter = '(&(objectClass=ucsschoolStaff)(objectClass=ucsschoolTeacher))'
roles = ['teacher', 'staff']
default_roles = ['teacher', 'staff']
default_options = ('ucsschoolStaff',)
classmethod get_container(school)[source]
get_specific_groups(lo)[source]
_attributes = {'school': <ucsschool.lib.models.attributes.SchoolAttribute object>, 'name': <ucsschool.lib.models.attributes.Username object>, 'firstname': <ucsschool.lib.models.attributes.Firstname object>, 'lastname': <ucsschool.lib.models.attributes.Lastname object>, 'ucsschool_roles': <ucsschool.lib.models.attributes.Roles object>, 'school_classes': <ucsschool.lib.models.attributes.SchoolClassesAttribute object>, 'disabled': <ucsschool.lib.models.attributes.Disabled object>, 'birthday': <ucsschool.lib.models.attributes.Birthday object>, 'schools': <ucsschool.lib.models.attributes.Schools object>, 'password': <ucsschool.lib.models.attributes.Password object>, 'email': <ucsschool.lib.models.attributes.Email object>}
_meta = <ucsschool.lib.models.meta.UCSSchoolHelperOptions object>
logger = <Proxy at 0x7fbbb087d4d0 wrapping <celery.utils.log.ProcessAwareLogger object> at 0x7fbba7520410 with factory <function <lambda>>>
class ucsschool.lib.models.user.ExamStudent(*args, **kwargs)[source]

Bases: ucsschool.lib.models.user.Student

type_name = 'Exam student'
type_filter = '(&(objectClass=ucsschoolStudent)(objectClass=ucsschoolExam))'
default_roles = ['exam_user']
default_options = ('ucsschoolExam',)
classmethod get_container(school)[source]
_attributes = {'school': <ucsschool.lib.models.attributes.SchoolAttribute object>, 'name': <ucsschool.lib.models.attributes.Username object>, 'firstname': <ucsschool.lib.models.attributes.Firstname object>, 'lastname': <ucsschool.lib.models.attributes.Lastname object>, 'ucsschool_roles': <ucsschool.lib.models.attributes.Roles object>, 'school_classes': <ucsschool.lib.models.attributes.SchoolClassesAttribute object>, 'disabled': <ucsschool.lib.models.attributes.Disabled object>, 'birthday': <ucsschool.lib.models.attributes.Birthday object>, 'schools': <ucsschool.lib.models.attributes.Schools object>, 'password': <ucsschool.lib.models.attributes.Password object>, 'email': <ucsschool.lib.models.attributes.Email object>}
_meta = <ucsschool.lib.models.meta.UCSSchoolHelperOptions object>
classmethod from_student_dn(lo, school, dn)[source]
logger = <Proxy at 0x7fbbb087d488 wrapping <celery.utils.log.ProcessAwareLogger object> at 0x7fbba7520410 with factory <function <lambda>>>

ucsschool.lib.models.utils module

ucsschool.lib.models.utils._load_logging_config(path='/etc/ucsschool/logging.yaml')[source]
ucsschool.lib.models.utils._ucr()[source]
ucsschool.lib.models.utils._remove_password_from_log_record(record)[source]
class ucsschool.lib.models.utils.UniFileHandler(filename, when='h', interval=1, backupCount=0, encoding=None, delay=False, utc=False, fuid=None, fgid=None, fmode=None)[source]

Bases: logging.handlers.TimedRotatingFileHandler

TimedRotatingFileHandler that can set file permissions and removes password entries from from dicts in args.

_open()[source]

set file permissions on log file

emit(record)[source]

remove password from from dicts in args

class ucsschool.lib.models.utils.UniStreamHandler(stream=None, fuid=None, fgid=None, fmode=None)[source]

Bases: sphinx.ext.autodoc.StreamHandler

Colorizing console stream handler that removes password entries from from dicts in args.

fuid, fgid and fmode are here only for similarity of interface to UniFileHandler and are ignored.

emit(record)[source]

remove password from from dicts in args

class ucsschool.lib.models.utils.ModuleHandler(level=0, udebug_facility=8)[source]

Bases: logging.Handler

Adapter: use Python logging but emit through univention debug

LOGGING_TO_UDEBUG = {'INFO': 2, 'WARN': 1, 'CRITICAL': 0, 'WARNING': 1, 'ERROR': 0, 'DEBUG': 3, 'NOTSET': 3}
emit(record)[source]

log to univention debug, remove password from dicts in args

class ucsschool.lib.models.utils.UCSTTYColoredFormatter[source]

Bases: sphinx.ext.autodoc.TTYColoredFormatter

Subclass of colorlog.TTYColoredFormatter that will force colorization on, in case UCSSCHOOL_FORCE_COLOR_TERM is found in env.

color(log_colors, level_name)[source]
ucsschool.lib.models.utils.add_stream_logger_to_schoollib(level='DEBUG', stream=<open file '<stderr>', mode 'w'>, log_format=None, name=None)[source]

Outputs all log messages of the models code to a stream (default: “stderr”):

from ucsschool.lib.models.utils import add_stream_logger_to_schoollib
add_module_logger_to_schoollib()
# or:
add_module_logger_to_schoollib(level='ERROR', stream=sys.stdout, log_format='ERROR (or worse): %(message)s')
ucsschool.lib.models.utils.add_module_logger_to_schoollib()[source]
ucsschool.lib.models.utils.create_passwd(length=8, dn=None, specials='$%&*-+=:.?')[source]
ucsschool.lib.models.utils.flatten(list_of_lists)[source]
ucsschool.lib.models.utils.loglevel_int2str(level)[source]

Convert numeric loglevel to string name.

ucsschool.lib.models.utils.nearest_known_loglevel(level)[source]

Get loglevel nearest to those known in CMDLINE_LOG_FORMATS and FILE_LOG_FORMATS.

ucsschool.lib.models.utils.get_stream_handler(level, stream=None, fmt=None, datefmt=None, fmt_cls=None)[source]

Create a colored stream handler, usually for the console.

Parameters:
  • level (int or str) – log level
  • stream (file) – opened file to write to (/dev/stdout if None)
  • fmt (str) – log message format (will be passt to a Formatter instance)
  • datefmt (str) – date format (will be passt to a Formatter instance)
  • fmt_cls (type) – Formatter class to use, defaults to UCSTTYColoredFormatter
Returns:

a handler

Return type:

logging.Handler

ucsschool.lib.models.utils.get_file_handler(level, filename, fmt=None, datefmt=None, uid=None, gid=None, mode=None)[source]

Create a UniFileHandler (TimedRotatingFileHandler) for logging to a file.

Parameters:
  • level (int or str) – log level
  • filename (str) – path of file to write to
  • fmt (str) – log message format (will be passt to a Formatter instance)
  • datefmt (str) – date format (will be passt to a Formatter instance)
  • uid (int) – user that the file should belong to (current user if None)
  • gid (int) – group that the file should belong to (current users primary group if None)
  • mode (int) – permissions of the file
Returns:

a handler

Return type:

logging.Handler

ucsschool.lib.models.utils.get_logger(name, level='INFO', target=<open file '<stdout>', mode 'w'>, handler_kwargs=None, formatter_kwargs=None)[source]

Get a logger object below the ucsschool root logger.

Deprecated since version 4.4: v2 Use logging.getLogger(__name__) and get_stream_handler(), get_file_handler().

  • The logger will use UniStreamHandler(StreamHandler) for streams (sys.stdout etc) and UniFileHandler(TimedRotatingFileHandler) for files if not configured differently through handler_kwargs[cls].
  • A call with the same name will return the same logging object.
  • There is only one handler per name-target combination.
  • If name and target are the same, and only the log level changes, it will return the logging object with the same handlers and change both the log level of the respective handler and of the logger object to be the lowest of the previous and the new level.
  • Complete output customization is possible, setting kwargs for the constructors of the handler and formatter.
  • Using custom handler and formatter classes is possible by configuring the ‘cls’ key of handler_kwargs and formatter_kwargs.
Parameters:
  • name – str: will be appended to “ucsschool.” as name of the logger
  • level – str: loglevel (DEBUG, INFO etc)
  • target – stream (open file) or a str (file path)
  • handler_kwargs – dict: will be passed to the handlers constructor. It cannot be used to modify a handler, as it is only used at creation time. If it has a key ‘cls’ it will be used as handler instead of UniFileHandler or UniStreamHandler. It should be a subclass of one of those!
  • formatter_kwargs – dict: will be passed to the formatters constructor, if it has a key ‘cls’ it will be used to create a formatter instead of logging.Formatter.
Returns:

a python logging object

ucsschool.lib.models.utils.exec_cmd(cmd, log=False, raise_exc=False, **kwargs)[source]

Execute command.

Parameters:
  • cmd (list(str)) – command line as list of strings
  • log (bool) – log text returned in stdout (with level INFO) and text returned in stderr (with level ERROR)
  • raise_exc (bool) – raise RunTime
  • kwargs (dict) – arguments to pass to subprocess.Popen() call
Returns:

3-tuple: returncode (int), stdout (str), stderr (str)

Return type:

tuple(int, str, str)

Raises:
  • subprocess.CalledProcessError – if raise_exc is True and the return code was != 0
  • OSError – if cmd[0] does not exist: “No such file or directory”
ucsschool.lib.models.utils.stopped_notifier(*args, **kwds)[source]

Stops univention-directory-notifier while in a block and starts it in the end. Service if stopped/started by /etc/init.d.

Will not start if ucr get notifier/autostart=no – but will stop!

with stopped_notifier():
        ...
Parameters:strict (bool) – raise RuntimeError if stopping fails
Raises:RuntimeError – if stopping failed and strict=True
ucsschool.lib.models.utils._write_logging_config(path='/etc/ucsschool/logging.yaml')[source]