ucsschool.lib package
Contents
ucsschool.lib package¶
Subpackages¶
- ucsschool.lib.models package
- Submodules
- ucsschool.lib.models.attributes module
- ucsschool.lib.models.base module
- ucsschool.lib.models.computer module
- ucsschool.lib.models.dhcp module
- ucsschool.lib.models.group module
- ucsschool.lib.models.hook module
- ucsschool.lib.models.meta module
- ucsschool.lib.models.misc module
- ucsschool.lib.models.network module
- ucsschool.lib.models.policy module
- ucsschool.lib.models.school module
- ucsschool.lib.models.share module
- ucsschool.lib.models.user module
- ucsschool.lib.models.validator module
- ucsschool.lib.pyhooks package
Submodules¶
ucsschool.lib.consistency module¶
ucsschool.lib.create_ou module¶
ucsschool.lib.i18n module¶
- ucsschool.lib.i18n.ucs_school_name_i18n(name, lang='de')[source]¶
i18n function for localization of UCS@school standard names
ucsschool.lib.info module¶
- class ucsschool.lib.info.MembershipFlags(is_edu_school_member, is_admin_school_member)¶
Bases:
tuple
Create new instance of MembershipFlags(is_edu_school_member, is_admin_school_member)
- property is_admin_school_member¶
Alias for field number 1
- property is_edu_school_member¶
Alias for field number 0
- ucsschool.lib.info.get_school_membership_type(lo, dn)[source]¶
Returns a named tuple, that states if the given computer object specified by dn is an educational school Replica Directory Node/Managed Node or administrative Replica Directory Node/Managed Node.
- Parameters
lo (univention.uldap.access) – the LDAP connection
dn (str) – DN of the computer object
- Returns
a named tuple that contains flags for educational and administrative membership
- Return type
namedtuple(is_edu_school_member, is_admin_school_member)
- ucsschool.lib.info.is_central_computer(lo, dn)[source]¶
Checks if the given computer object specified by dn is a central system or located at a specific school.
- Parameters
lo (univention.uldap.access) – the LDAP connection
dn (str) – DN of the computer object
- Returns
is the computer a central system?
- Return type
- ucsschool.lib.info.is_school_slave(lo, dn)[source]¶
Checks if the given domaincontroller_slave object (specified by dn) is a school Replica Node.
- Parameters
lo (univention.uldap.access) – the LDAP connection
dn (str) – DN of the computer object
- Returns
is the computer a school Replica Directory Node?
- Return type
- Raises
ValueError – computer DN does not refer to a computers/domaincontroller_slave object
ucsschool.lib.internetrules module¶
- class ucsschool.lib.internetrules.Rule(name, type=0, priority=0, wlan=False, domains=[], userRule=False)[source]¶
Bases:
object
- property domains¶
Return list of all domains, the order respects the indeces. Show only the entries that match the current filter type.
- ucsschool.lib.internetrules.findUCRVariables(filterName=None, userRule=False)[source]¶
Returns a dict of all UCR variables or all variables matching the specified rule name.
- ucsschool.lib.internetrules.remove(name, userRule=False)[source]¶
Removes the UCR variables corresponding to the specified rule.
- ucsschool.lib.internetrules.list(filterName=None, userRule=False)[source]¶
Returns a list of all existing rules. If name is given, returns only the rule matching the specified name or None. userRule specifies whether all common rules (=False) or only user-specific rules (=True) are listed. If filterName is specified, only rule matching this name is returned as single object (not as list!).
- ucsschool.lib.internetrules.getGroupRuleName(groupNames)[source]¶
Return the name of the filter rule for the specified group name.
- Usage:
getGroupRuleName([<groupName>, …]) -> { <groupName>:<ruleName>, … }
- or:
getGroupRuleName(<groupName) -> <ruleName>
ucsschool.lib.roles module¶
- ucsschool.lib.roles.create_ucsschool_role_string(role, context, context_type='school', school='')[source]¶
This function takes a role, a context_type and a context to create a valid ucsschoolRole string. :param role: The role :param context: The context :param context_type: The context type :param school: Old variable name for context. DEPRECATED! TODO: Should be removed in 4.4v5 :return: The valid ucsschoolRole string
- ucsschool.lib.roles.get_role_info(ucsschool_role_string)[source]¶
This function separates the individual elements of an ucsschool role string. Raises InvalidUcsschoolRoleString if the string provided is no valid role string. Raises UnknownRole if the role is unknown. Raises UnknownContextType if the context type is unknown. :param ucsschool_role_string: The role string to separate :return: (role, context_type, context)
ucsschool.lib.school_umc_base module¶
- class ucsschool.lib.school_umc_base.SchoolSanitizer(regex_pattern=None, re_flags=0, minimum=None, maximum=None, **kwargs)[source]¶
Bases:
univention.management.console.modules.sanitizers.StringSanitizer
- class ucsschool.lib.school_umc_base.SchoolBaseModule(domain='univention-management-console')[source]¶
Bases:
univention.management.console.base.Base
This class serves as base class for UCS@school UMC modules that need LDAP access. It initiates the list of available OUs (self.availableSchools) and initiates the search bases (self.searchBase). set_bind_function() is called automatically to allow LDAP connections. In order to integrate this class into a module, use the following paradigm:
- class Instance(SchoolBaseModule):
- def __init__(self):
# initiate list of internal variables SchoolBaseModule.__init__(self) # … custom code
- def init(self):
SchoolBaseModule.init(self) # … custom code
ucsschool.lib.school_umc_ldap_connection module¶
- ucsschool.lib.school_umc_ldap_connection.LDAP_Connection(*connection_types)[source]¶
This decorator function provides access to internally cached LDAP connections that can be accessed via adding specific keyword arguments to the function.
The function which uses this decorator may specify the following additional keyword arguments:
- Parameters
ldap_position (univention.admin.uldap.position) – a valid ldap position.
ldap_user_read – a read only LDAP connection to the local LDAP server authenticated with the currently used user
ldap_user_write – a read/write LDAP connection to the master LDAP server authenticated with the currently used user
ldap_machine_read – a read only LDAP connection to the local LDAP server authenticated with the machine account
ldap_machine_write – a read/write LDAP connection to the master LDAP server authenticated with the machine account
ldap_admin_write – a read/write LDAP connection to the master LDAP server authenticated with cn=admin account
search_base – (deprecated!) a SchoolSearchBase instance which is bound to the school of the user or machine.
This decorator can only be used after
set_bind_function()
has been executed.@LDAP_Connection() def do_ldap_stuff(arg1, arg2, ldap_user_write=None, ldap_user_read=None, ldap_position=None): ... ldap_user_read.searchDn(..., position=ldap_position) ...
ucsschool.lib.schoolldap module¶
- class ucsschool.lib.schoolldap.SchoolSearchBase(availableSchools, school=None, dn=None, ldapBase=None)[source]¶
Bases:
object
Deprecated: don’t use position to identify user objects
- ucr = None¶
- group_prefix_students = ''¶
- group_prefix_teachers = ''¶
- group_prefix_admins = ''¶
- group_prefix_staff = ''¶
- classmethod getOU(dn)[source]¶
Return the school OU for a given DN.
>>> SchoolSearchBase.getOU('uid=a,fou=bar,Ou=dc1,oU=dc,dc=foo,dc=bar') 'dc1'
- classmethod getOUDN(dn)[source]¶
Return the School OU-DN part for a given DN.
>>> SchoolSearchBase.getOUDN('uid=a,fou=bar,Ou=dc1,oU=dc,dc=foo,dc=bar') 'Ou=dc1,oU=dc,dc=foo,dc=bar' >>> SchoolSearchBase.getOUDN('ou=dc1,ou=dc,dc=foo,dc=bar') 'ou=dc1,ou=dc,dc=foo,dc=bar' >>> SchoolSearchBase.getOUDN('dc=foo,dc=bar') 'dc=foo,dc=bar'
- property dhcp¶
- property policies¶
- property networks¶
- property school¶
- property schoolDN¶
- property users¶
- property groups¶
- property students_group¶
- property teachers_group¶
- property staff_group¶
- property admins_group¶
- property workgroups¶
- property classes¶
- property rooms¶
- property students¶
- property teachers¶
- property teachersAndStaff¶
- property staff¶
- property admins¶
- property printers¶
- property computers¶
- property examUsers¶
- property globalGroupContainer¶
- property educationalDCGroup¶
- property educationalMemberGroup¶
- property administrativeDCGroup¶
- property administrativeMemberGroup¶
- property examGroupName¶
- property examGroup¶
ucsschool.lib.schoollessons module¶
- class ucsschool.lib.schoollessons.Lesson(name, begin, end)[source]¶
Bases:
object
- TIME_REGEX = re.compile('^([01][0-9]|2[0-3]|[0-9]):([0-5][0-9])')¶
- property name¶
- property begin¶
- property end¶