Bug 47966 - Add functions to univention.lib to query types of given computer objects
Add functions to univention.lib to query types of given computer objects
Status: CLOSED FIXED
Product: UCS@school
Classification: Unclassified
Component: Ucsschool-lib
UCS@school 4.3
Other Linux
: P5 normal (vote)
: UCS@school 4.3 v6
Assigned To: Sönke Schwardt-Krummrich
Daniel Tröder
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2018-10-12 12:25 CEST by Sönke Schwardt-Krummrich
Modified: 2018-11-16 11:48 CET (History)
1 user (show)

See Also:
What kind of report is it?: Development Internal
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sönke Schwardt-Krummrich univentionstaff 2018-10-12 12:25:52 CEST
Within the samba packages some functions are required to determine if a given computer object is a "central computer" or if it is related to a specific school.
Comment 1 Sönke Schwardt-Krummrich univentionstaff 2018-11-06 11:38:15 CET
Added a new python module ucsschool.lib.info:

MembershipFlags = namedtuple('MembershipFlags', 
                             ['is_edu_school_member', 'is_admin_school_member'])

def get_school_membership_type(lo, dn):  
                        # type: (univention.uldap.Access, str) -> MembershipFlags

def is_central_computer(lo, dn):  # type: (univention.uldap.Access, str) -> bool

def is_school_slave(lo, dn):  # type: (univention.uldap.Access, str) -> bool



A new ucs-test script 90_ucsschool/400_ucsschool_lib_info has been added, that checks the API with different computer objects.


d52c92bfc Bug #47966: bump version
916e879da Bug #47966: test exception if no slave DN has been passed to is_school_slave()
e756462b6 Bug #47966: add missing mypy annotation
7bf5a2d80 Bug #47966: update advisory
de32431d1 Bug #47966: add changelog entry
50928201c Bug #47966: add 400_ucsschool_lib_info
3f4f31a4e Bug #47966: add advisory
5f31a2185 Bug #47966: add changelog entry
470fd9977 Bug #47966: add simple interface to check school membership of computers


Package: ucs-school-lib
Version: 11.0.1-28A~4.3.0.201811051422
Branch: ucs_4.3-0
Scope: ucs-school-4.3

Package: ucs-test-ucsschool
Version: 5.0.2-100A~4.3.0.201811061053
Branch: ucs_4.3-0
Scope: ucs-school-4.3
Comment 2 Daniel Tröder univentionstaff 2018-11-07 09:00:42 CET
If I read get_school_membership_type() correctly, it is enough to be in either cn=DC-Edukativnetz or cn=OU$OU-DC-Edukativnetz to be counted as a edu school server. Is that intended?

If that should not be the case, I suggest to a) create a system diagnose module to warn about such "broken" school objects and b) the code testing for cn=OU$OU-DC-Edukativnetz would not be required.
Comment 3 Sönke Schwardt-Krummrich univentionstaff 2018-11-07 12:09:23 CET
(In reply to Daniel Tröder from comment #2)
> If I read get_school_membership_type() correctly, it is enough to be in
> either cn=DC-Edukativnetz or cn=OU$OU-DC-Edukativnetz to be counted as a edu
> school server. Is that intended?
> 
> If that should not be the case, I suggest to a) create a system diagnose
> module to warn about such "broken" school objects and b) the code testing
> for cn=OU$OU-DC-Edukativnetz would not be required.

a) I created a draft for am diagnostic module. I think we will add the module 
   to UCS@school via a seperate bug.
b) I would like to keep the code there for safety now. But you are right, if
   we assure that global and OU-specific group memberships are consistent, the 
   ou-specific test is no longer required.

bc4fe3824 Bug #47966: fixed mypy annotations and doc strings
Comment 4 Daniel Tröder univentionstaff 2018-11-07 16:13:21 CET
OK: code
OK: manual test
OK: automatic test
OK: advisory
Comment 5 Sönke Schwardt-Krummrich univentionstaff 2018-11-16 11:48:12 CET
UCS@school 4.3 v6 has been released.

https://docs.software-univention.de/changelog-ucsschool-4.3v6-de.html

If this error occurs again, please clone this bug.