Bug 34070 - Extended Attributes in syntax.d are not handled the same as in syntax.py
Extended Attributes in syntax.d are not handled the same as in syntax.py
Status: CLOSED DUPLICATE of bug 43094
Product: UCS
Classification: Unclassified
Component: UDM - Extended Attributes
UCS 4.2
Other Linux
: P5 normal (vote)
: UCS 4.x
Assigned To: Florian Best
Sönke Schwardt-Krummrich
:
Depends on:
Blocks: 32096
  Show dependency treegraph
 
Reported: 2014-02-07 12:24 CET by Sönke Schwardt-Krummrich
Modified: 2017-01-23 16:39 CET (History)
3 users (show)

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 3: Simply Wrong: The implementation doesn't match the docu
Who will be affected by this bug?: 2: Will only affect a few installed domains
How will those affected feel about the bug?: 2: A Pain – users won’t like this once they notice it
User Pain: 0.069
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional): Cleanup
Max CVSS v3 score:


Attachments
Same syntax - different widgets (16.62 KB, image/png)
2014-02-07 12:24 CET, Sönke Schwardt-Krummrich
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sönke Schwardt-Krummrich univentionstaff 2014-02-07 12:24:21 CET
Created attachment 5782 [details]
Same syntax - different widgets

Syntax definitions in syntax.py are not handled the same as in syntax.d/FOO.py
(see screenshot).

Setup was like this:

root@master:/usr/share/pyshared/univention/admin# grep -A8 FastPrinterList syntax.py
class FastPrinterList( UDM_Objects ):
        udm_modules = ( 'shares/printer', )
        key = 'dn'
        label = 'dn'
        simple = True
        use_objects = False
        empty_value = True


root@master:/usr/share/pyshared/univention/admin# cat syntax.d/fastprinterlist.py 
class FastPrinterListExt( UDM_Objects ):
        udm_modules = ( 'shares/printer', )
        key = 'dn'
        label = 'dn'
        simple = True
        use_objects = False
        empty_value = True

root@master:/usr/share/pyshared/univention/admin# udm settings/extended_attribute list

DN: cn=TEST-INT,cn=custom attributes,cn=univention,dc=nstx,dc=local
ARG: None
  objectClass: univentionFreeAttributes
  groupPosition: None
  module: groups/group
  overwritePosition: None
  hook: None
  overwriteTab: 0
  shortDescription: TEST-syntax.py
  groupName: TEST
  version: 2
  valueRequired: 0
  CLIName: TEST-INT
  fullWidth: 0
  longDescription: None
  doNotSearch: 0
  tabName: TEST
  syntax: FastPrinterList
  tabAdvanced: 0
  name: TEST-INT
  default: None
  mayChange: 1
  multivalue: 0
  ldapMapping: univentionFreeAttribute1
  deleteObjectClass: 0
  notEditable: 0
  tabPosition: None
  disableUDMWeb: 0

DN: cn=TEST-EXT,cn=custom attributes,cn=univention,dc=nstx,dc=local
ARG: None
  objectClass: univentionFreeAttributes
  groupPosition: None
  module: groups/group
  overwritePosition: None
  hook: None
  overwriteTab: 0
  shortDescription: TEST-syntax.d
  groupName: TEST
  version: 2
  valueRequired: 0
  CLIName: TEST-EXT
  fullWidth: 0
  longDescription: None
  doNotSearch: 0
  tabName: TEST
  syntax: FreePrinterListExt
  tabAdvanced: 0
  name: TEST-EXT
  default: None
  mayChange: 1
  multivalue: 0
  ldapMapping: univentionFreeAttribute1
  deleteObjectClass: 0
  notEditable: 0
  tabPosition: None
  disableUDMWeb: 0

root@master:/usr/share/pyshared/univention/admin#

Traceback of Bug 32096 was also triggered. Add a "lookup_filter" method to shares/printer.py:

-- printer.py.BACKUP   2014-02-07 11:26:37.000000000 +0100
+++ printer.py.printerassignment        2014-02-07 11:34:40.000000000 +0100
@@ -365,6 +365,14 @@
                        printergroup_object['groupMember'].remove(self.info['name'])
                        printergroup_object.modify()
 
+def lookup_filter(filter_s=None, lo=None):
+       lookup_filter_obj = univention.admin.filter.conjunction('&', [
+               univention.admin.filter.expression('objectClass', 'univentionPrinter'),
+                ])
+        lookup_filter_obj.append_unmapped_filter_string(filter_s, univention.admin.mapping.mapRewrite, mapping)
+        return lookup_filter_obj
+
+
 def lookup(co, lo, filter_s, base='', superordinate=None, scope='sub', unique=0, required=0, timeout=-1, sizelimit=0):
 
        filter=univention.admin.filter.conjunction('&', [
Comment 1 Janek Walkenhorst univentionstaff 2014-04-15 15:04:44 CEST
A syntax inheriting "IStates" does not work but inheriting from "select" does work.
Comment 2 Florian Best univentionstaff 2016-05-11 12:33:28 CEST
Is this still unfixed in UCS 4.1?
My guess is that the reload(syntax) causes that issubcluss/isinstance(foo, UDM_Objects) causes to return False as the original instance doesn't exists anymore.
Comment 3 Florian Best univentionstaff 2017-01-10 12:04:39 CET
from univention.management.console.modules.udm import *
set_bind_function(lambda lo: lo.bind('uid=Administrator,cn=users,dc=school,dc=local', 'univention'))
group = UDM_Module('groups/group')
props = group.properties
a, b = [x for x in props if x['id'].startswith('TEST')]
import univention
print univention.admin.handlers.groups.group.property_descriptions['TEST-EXT'].syntax.name
'string'
Comment 4 Florian Best univentionstaff 2017-01-10 12:06:57 CET
At first I thought this is a duplicate of Bug #43094.
Then I saw it wasn't and debugged it. And this is what I found:

(In reply to Sönke Schwardt-Krummrich from comment #0)
> root@master:/usr/share/pyshared/univention/admin# cat
> syntax.d/fastprinterlist.py 
> class FastPrinterListExt( UDM_Objects ):> DN: cn=TEST-EXT,cn=custom attributes,cn=univention,dc=nstx,dc=local>   syntax: FreePrinterListExt
…
→ "FreePrinterListExt" != "FastPrinterListExt"

INVALID!
Comment 5 Florian Best univentionstaff 2017-01-10 12:10:03 CET
Oh well, but if I fix your typo then I can reproduce it with the old package. It is fixed with the new package.

*** This bug has been marked as a duplicate of bug 43094 ***
Comment 6 Florian Best univentionstaff 2017-01-23 16:39:00 CET
<http://errata.software-univention.de/ucs/4.1/376.html>