Bug 48621 - Add Tab to enable apps
Add Tab to enable apps
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: UMC - Users
UCS 4.4
Other Linux
: P5 normal (vote)
: UCS 4.4
Assigned To: Florian Best
Dirk Wiesenthal
: interim-2
: 48788 48796 48854 (view as bug list)
Depends on: 48845
Blocks: 48791 48839 48895
  Show dependency treegraph
 
Reported: 2019-02-06 14:32 CET by Florian Best
Modified: 2019-03-12 13:40 CET (History)
4 users (show)

See Also:
What kind of report is it?: Feature Request
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): Usability
Max CVSS v3 score:


Attachments
Mock Up (54.89 KB, image/png)
2019-02-06 14:32 CET, Florian Best
Details
Screenshot (current state) (77.64 KB, image/png)
2019-02-06 16:41 CET, Florian Best
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Florian Best univentionstaff 2019-02-06 14:32:43 CET
Created attachment 9829 [details]
Mock Up

The users/user view should have a tab which shows a checkbox for every available app and to activate users for this app.

See attachment for a mock up.
Comment 1 Florian Best univentionstaff 2019-02-06 16:41:51 CET
Created attachment 9830 [details]
Screenshot (current state)
Comment 2 Florian Best univentionstaff 2019-02-07 17:19:09 CET
Implemented in the branch fbest/udm-app-tabs. Not yet merged into 4.4-0, will do that as soon as the apps are adjusted (Bug #48623).
Comment 3 Florian Best univentionstaff 2019-02-07 17:43:09 CET
I made some pseudo-API-changes for the .attributes file:
Type=ExtendedAttribute must be set now, so it's future proof for things which are added later.
If type is not set, only a log message is produced.

The old code does not consider if attributes are removed! Therefore if one attribute gets removed and another gets added it would get the OID of the old attribute. I won't adjust/fix this. It could be done e.g. with "Type=DeprecatedOID; ID=2".

Another change is, that it's not necessary to create a "appidActivated" boolean attribute anymore. The object-class can e.g. be used as indicator. But as there are apps out which use this feature already, the attribute is still written if GenericUserActivation=Version1.
Comment 5 Florian Best univentionstaff 2019-02-15 18:00:10 CET
The appcenter does a udm settings/extended_attribute create $all_args; udm setttings/extended_attribute modify $all_args.

This causes the following traceback:

Type or value exists: modify/add: univentionUDMPropertyLayoutOverwritePosition: value #0 already exists
Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/univention/appcenter/actions/__init__.py", line 226, in call_with_namespace
    result = self.main(namespace)
  File "/usr/lib/pymodules/python2.7/univention/appcenter/actions/register.py", line 87, in main
    self._register_attributes_for_apps(apps, args)
  File "/usr/lib/pymodules/python2.7/univention/appcenter/actions/register.py", line 196, in _register_attributes_for_apps
    self._register_attributes(app, args)
  File "/usr/lib/pymodules/python2.7/univention/appcenter/actions/register.py", line 241, in _register_attributes
    create_extended_attribute(attribute, app, i + 1, lo, pos)
  File "/usr/lib/pymodules/python2.7/univention/appcenter/extended_attributes.py", line 405, in create_extended_attribute
    modify_object('settings/extended_attribute', lo, pos, attribute.dn, **attrs)
  File "/usr/lib/pymodules/python2.7/univention/appcenter/udm.py", line 114, in modify_object
    obj.modify()
  File "/usr/lib/pymodules/python2.7/univention/admin/handlers/__init__.py", line 583, in modify
    dn = self._modify(modify_childs, ignore_license=ignore_license, response=response)
  File "/usr/lib/pymodules/python2.7/univention/admin/handlers/__init__.py", line 1222, in _modify
    self.lo.modify(self.dn, ml, ignore_license=ignore_license, serverctrls=serverctrls, response=response)
  File "/usr/lib/pymodules/python2.7/univention/admin/uldap.py", line 828, in modify
    raise univention.admin.uexceptions.ldapError(_err2str(msg), original_exception=msg)
ldapError: Type or value exists: modify/add: univentionUDMPropertyLayoutOverwritePosition: value #0 already exists

→ Needs to be fixed in UDM.
Comment 6 Florian Best univentionstaff 2019-02-15 18:25:34 CET
It was added here:

commit d56dd9692197b6acb4d7961627a7017c41a04b2a
Author: Andreas Büsching <buesching@univention.de>
Date:   Mon Oct 17 15:22:54 2011 +0000

    fix typo in script univention-remove-old-umc-objects; Bug #24045 ; fix handling of extended attributes; Bug #23988

    git-svn-id: svn+ssh://….univention.de/var/univention/svn/dev/branches/ucs-3.0/ucs@27891 1b283449-9f2f-0410-b571-8eb228e1a901


+»   »   if self.dn and self.info.has_key( 'overwritePosition' ) and self.info[ 'overwritePosition' ] == '0':
+»   »   »   self.info[ 'overwritePosition' ] = ''

Hm, i will just remove this from the OX extended attributes. I think overwritePosition isn't even evaluated anymore.
Comment 7 Florian Best univentionstaff 2019-02-19 14:41:53 CET
There was a interim regression when creating user templates:
LDAP Error: Object class violation: object class 'univentionMail' requires attribute 'uid'

http://jenkins.knut.univention.de:8080/job/UCS-4.4/job/UCS-4.4-0/job/AutotestJoin/lastCompletedBuild/SambaVersion=s4,Systemrolle=master/testReport/71_udm-settings/10_create_usertemplate/test/

This was caused by the extended attribute "cn=UniventionDovecotUserQuota" which always added a default value of "0" to the ldap while univentionTemplateObjects don't have a "uid" attribute.

Fixed by ommiting univentionMail extended attributes.
Comment 8 Florian Best univentionstaff 2019-02-21 11:07:14 CET
Fixed so far :-)
I'll might make some small adjustments to the layout but the basis functionality should be reviewed and QAed now.
Comment 9 Florian Best univentionstaff 2019-02-22 11:06:19 CET
The test case for user templates fails:
http://jenkins.knut.univention.de:8080/job/UCS-4.4/job/UCS-4.4-0/job/ADMemberMultiEnv/lastCompletedBuild/Mode=installation,Version=w2k12r2-france/testReport/71_udm-settings/11_use_usertemplate/test/

(2019-02-19 23:21:40.118031) Traceback (most recent call last):
(2019-02-19 23:21:40.118089)   File "11_use_usertemplate", line 77, in <module>
(2019-02-19 23:21:40.118190)     dn_template = udm.create_object(MOD_TMPL, wait_for_replication=False, **properties)
(2019-02-19 23:21:40.118250)   File "/usr/lib/pymodules/python2.7/univention/testing/udm.py", line 270, in create_object
(2019-02-19 23:21:40.118376)     raise UCSTestUDM_CreateUDMObjectFailed({'module': modulename, 'kwargs': kwargs, 'returncode': child.returncode, 'stdout': stdout, 'stderr': stderr})
(2019-02-19 23:21:40.118610) univention.testing.udm.UCSTestUDM_CreateUDMObjectFailed: returncode=3
(2019-02-19 23:21:40.118630) stdout=Invalid syntax: _options:
Comment 10 Florian Best univentionstaff 2019-02-22 12:07:32 CET
Sumarizing the changes:

Every app can now define a settings/extended_options object which maps option-name to ldap object class (e.g. appUser → appObjectClass).
All extended attributes of the app are adjusted to use the option (settings/extended_attribute modify --set option="appUser").

The schema for settings/extended_options has been adapted:
The attribute univentionUDMOptionIsApp 1.3.6.1.4.1.10176.200.209 has been added to the objectclass univentionUDMOption.
udm settings/extended_options create … --set isApp=1

Every app which currently specifies its enabled-state via an attribute *should* now change the visibility of that attribute to be hidden in UMC and the default to true (--set disableUDMWeb=1 --set default=1). Therefore the UMC isn't displaying 2 checkboxes per app but only one, to activate a user. And via the default value it's ensured that the appEnabled=1 is set. If the checkbox gets unmarked the object class and every attribute is removed from the object.
REOPEN: the current implementation doesn't consider objects which currently have appEnabled=FALSE set, which are then shown as activated while they are disabled.

Therefore *new* apps would be able to adjust their filter to "(objectClass=appUser)" instead of "(appEnabled=1)".

The UDM-CLI has been adjusted:
* create/modify now have the --remove-option --append-option
* create/modify now set the option automatically if --set appEnabled=1 was given without "--append-option appUser" (if the option only depends on one option, otherwise not, because e.g. in UCS@school attribute may have multiple options (teacher, admin, student, staff).

The usertemplates have been adjusted: You can use --set _options and --append-options both now. This makes the design in UMC much more better, as it behaves like a regular user now (with the options page instead of a drop down of options, so that some fields appear when you enable an option).

MulitEdit mode has been adjusted, so that you can modify options there. This does currently only work for all options, not for single options. I think we have to improove this further in the future.

The AppListener now writes the options also into the json file.

"Group"s of the UDM-layout may have a description. This description is shown again (and used for the "Activated Apps"-Group).

App ini files now may declare:
GenericUserActivationOption = name of the option
GenericUserActivationAttribute = name of the attribute

If GenericUserActivationAttribute is not set, no attribute will be created (imho suggested for new apps).
Comment 11 Dirk Wiesenthal univentionstaff 2019-02-23 20:49:03 CET
When installing OpenProject in 4.4, the App is missing the attribute openproject-isadmin. From the logs:

Unknown attribute type for section openprojectActivated: None
Unknown attribute type for section openproject-isadmin: None
Comment 12 Florian Best univentionstaff 2019-02-23 22:01:59 CET
(In reply to Dirk Wiesenthal from comment #11)
> When installing OpenProject in 4.4, the App is missing the attribute
> openproject-isadmin. From the logs:
> 
> Unknown attribute type for section openprojectActivated: None
> Unknown attribute type for section openproject-isadmin: None

That's because in the test-appcenter is not anymore the latest version!
Use the version from:
https://github.com/finnlabs/ucs-openproject/blob/master/dist/openproject.attributes
Comment 13 Dirk Wiesenthal univentionstaff 2019-02-25 14:07:11 CET
The icons are not distributed:
If I install an App on a memberserver, the UDM UMC module does not show the App icon on the Apps tab.
Comment 14 Florian Best univentionstaff 2019-02-26 10:09:05 CET
Okay, Dirk and I discussed the following solution:

We introduce two syntax classes (appActivatedTrue, appActivatedBoolean) which are distributed to all systems in the domain. The checkbox-extended-attributes of the apps are set to this syntax. These syntaxes do the correct handling in the underlying UDM. We backport the appcenter for UCS 4.3-erratum and make the app versions depend on that erratum. The erratum ignores all extended attributes, so everything behaves in UCS 4.3 exactly as prior. We migrate the joinscripts of the apps to .attributes files, which is possible with the erratum then.
Comment 15 Florian Best univentionstaff 2019-02-26 16:45:13 CET
Implemented the above variant. To test this, I updated the pull request for ownCloud/nextCloud. You can test it with these attribute files.

The icons have also been fixed.
Comment 16 Florian Best univentionstaff 2019-02-26 16:54:13 CET
*** Bug 48788 has been marked as a duplicate of this bug. ***
Comment 17 Florian Best univentionstaff 2019-02-27 13:19:19 CET
*** Bug 48796 has been marked as a duplicate of this bug. ***
Comment 18 Dirk Wiesenthal univentionstaff 2019-02-28 11:28:33 CET
Seems like the extended options do not get removed after uninstallation?

Minor: Apps with .attributes installed in 4.3 add a Tab "Apps", too. So we have two tabs afterwards. I guess we can overlook this?
Comment 19 Florian Best univentionstaff 2019-02-28 13:58:41 CET
(In reply to Dirk Wiesenthal from comment #18)
> Seems like the extended options do not get removed after uninstallation?
Cannot reproduce it. Are you sure?

> Minor: Apps with .attributes installed in 4.3 add a Tab "Apps", too. So we
> have two tabs afterwards. I guess we can overlook this?
I fixed this, so that they are all shown on one tab.
Comment 20 Dirk Wiesenthal univentionstaff 2019-02-28 17:33:43 CET
After update from 4.3 to 4.4, openprojectActivated and relutionActivated (and probably all the others) are still visible
Comment 21 Dirk Wiesenthal univentionstaff 2019-02-28 17:34:01 CET
(even after univention-app register on the newly updated system)
Comment 22 Florian Best univentionstaff 2019-02-28 18:26:07 CET
(In reply to Dirk Wiesenthal from comment #20)
> After update from 4.3 to 4.4, openprojectActivated and relutionActivated
> (and probably all the others) are still visible
Fixed.
Comment 23 Florian Best univentionstaff 2019-03-04 12:52:55 CET
The extended option is not created by default anymore and must be explicit set by GenericUserActivationOption = True / appidUser.

git commit f2114b0a2298c28321ad5666ceadf23e39eaea33.

It is not possible to prevent the automatic schema creation via the ini variable AutomaticSchemaCreation = False.

git commit 7925a0c4ac308d137e28679ecdc202e0e2083a2b
Comment 24 Dirk Wiesenthal univentionstaff 2019-03-05 00:06:34 CET
Looks great
Comment 25 Florian Best univentionstaff 2019-03-05 12:25:51 CET
*** Bug 48854 has been marked as a duplicate of this bug. ***
Comment 26 Felix Botner univentionstaff 2019-03-06 09:58:22 CET
this

 class optionsUsersUser(select):
-       choices = [
-               ('pki', _('Public key infrastructure account')),
-       ]
+       choices = [('pki', _('Public key infrastructure account'))]
+
+       @classmethod
+       def update_choices(cls):
+               users = univention.admin.modules.get('users/user')
+               if users:
+                       cls.choices = [(key, x.short_description) for key, x in users.options.items() if key != 'default']
+
+
+__register_choice_update_function(optionsUsersUser.update_choices)

breaks the 71_udm-settings.11_use_usertemplate.test

 Traceback (most recent call last):
(2019-03-06 07:32:11.221203)   File "11_use_usertemplate", line 77, in <module>
(2019-03-06 07:32:11.221229)     dn_template = udm.create_object(MOD_TMPL, wait_for_replication=False, **properties)
(2019-03-06 07:32:11.221258)   File "/usr/lib/pymodules/python2.7/univention/testing/udm.py", line 270, in create_object
(2019-03-06 07:32:11.221317)     raise UCSTestUDM_CreateUDMObjectFailed({'module': modulename, 'kwargs': kwargs, 'returncode': child.returncode, 'stdout': stdout, 'stderr': stderr})
(2019-03-06 07:32:11.221351) univention.testing.udm.UCSTestUDM_CreateUDMObjectFailed: returncode=3
(2019-03-06 07:32:11.221373) stdout=Invalid syntax: _options:
(2019-03-06 07:32:11.221392) stderr=
(2019-03-06 07:32:11.221412) module=settings/usertemplate
(2019-03-06 07:32:11.221514) kwargs={'homedrive': 'H:', 'disabled': '1', 'homeShare': 'cn=c3oh4yr6kb,dc=AutoTest091,dc=local', 'postcode': '1', 'scriptpath': '//bdf64sof0i/scripts/<username>', 'city': 'iep6towqcn', 'employeeType': 'ggdcug460j', 'sambahome': '//bdf64sof0i/<username>', 'title': 'uxaw6nrztd', 'mailAlternativeAddress': ['<username>@v6nmhk4mds.ai1v300yrj', '<lastname>@v6nmhk4mds.ai1v300yrj'], 'homeSharePath': '<username>[0]/<username>', 'e-mail': 'i7ithp3usf.v6nmhk4mds.ai1v300yrj', 'pwdChangeNextLogin': '1', 'unixhome': '/home/<username>[0]/<username>', 'departmentNumber': '0', 'shell': '/bin/false', 'description': 'kigj6214vq', 'phone': '+49-421-22232-0', 'employeeNumber': '8', 'groups': ['cn=s9osdvj11k,cn=groups,dc=AutoTest091,dc=local', 'cn=dfvryr0w6a,cn=groups,dc=AutoTest091,dc=local'], 'primaryGroup': 'cn=ozew6x0obl,cn=groups,dc=AutoTest091,dc=local', 'mailPrimaryAddress': '<firstname>.<lastname>@v6nmhk4mds.ai1v300yrj', 'displayName': '<lastname>, <firstname>', 'name': 'snj7ijlazg', '_options': ['pki'], 'country': 'DE', 'roomNumber': '3', 'street': 'ofogh86f6w', 'profilepath': '//bdf64sof0i/profile/<username>', 'organisation': 'bpg1udx2nt', 'secretary': 'uid=daeru7yu7y,cn=users,dc=AutoTest091,dc=local'}
Comment 27 Florian Best univentionstaff 2019-03-06 12:20:33 CET
(In reply to Felix Botner from comment #26)
Thanks, fixed in 89ce1861.
Comment 28 Dirk Wiesenthal univentionstaff 2019-03-08 03:44:52 CET
Ok, works.

Fixed 80_docker/68_extended_attributes.
Comment 29 Florian Best univentionstaff 2019-03-12 13:40:49 CET
UCS 4.4 has been released:
 https://docs.software-univention.de/release-notes-4.4-0-en.html
 https://docs.software-univention.de/release-notes-4.4-0-de.html

If this error occurs again, please use "Clone This Bug".