Bug 53675 - [4.4] Feature: Scheduled activation of user accounts
[4.4] Feature: Scheduled activation of user accounts
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: UDM (Generic)
UCS 4.4
Other Linux
: P5 normal (vote)
: UCS 4.4-8-errata
Assigned To: Florian Best
Erik Damrose
:
: 48904 (view as bug list)
Depends on: 53631
Blocks: 53718
  Show dependency treegraph
 
Reported: 2021-08-19 09:57 CEST by Arvid Requate
Modified: 2021-09-15 18:08 CEST (History)
6 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?: Yes
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number: 2021071221000421
Bug group (optional): Further conceptual development
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Arvid Requate univentionstaff 2021-08-19 09:57:28 CEST
This feature should be available in UCS 4.4 too.


+++ This bug was initially created as a clone of Bug #53631 +++

Ticket# 2021071221000421 requests this feature:

User story: An administator wants to create a user account but it should only become usable later. At a definable point in time the account gets activated automatically.
Comment 1 Arvid Requate univentionstaff 2021-08-25 22:38:03 CEST
9fd9a4fcfb Bug #53631: register UDM property accountActivationDate
010e97fc02 Bug #53631: Define dedicated syntax for UDM property accountActivationDate
b164bcfa65 Bug #53631: Adjust layout
c510c8a103 Bug #53631: set disabled state if accountActivationDate > now
8f57915ba0 Bug #53631: Add cron based account activation
5609e0fa31 Bug #53631: Use LDAPI to reduce slapd load
5b66377b4d Bug #53631: Testcase for accountActivationDate
49e3354cee Bug #53631: Explain accountActivationDate in manual
53614be86e Bug #53631: Clean up krb5ValidStart in case krb5ValidEnd has also passed
109e9edbae Bug #53631: Extend testcases
3ee218de09 Bug #53631: Reset accountActivationDate to default if disabled state gets changed back to 0
a025909df0 Bug #53631: Convert testcase to Python
e4e3895345 Bug #53675: Merge branch 'arequate/bug53675-ucs-issue-651-krb5ValidStart'
51cd65aacd Bug #53675: debian/changelog entries and advisory
584a115b71 Bug #53675: Advisory update
Comment 2 Arvid Requate univentionstaff 2021-08-29 20:08:55 CEST
Test cases for ucsschool:

a50bc5638 Bug #53675: Add accountActivationDate to user model
db6af5809 Bug #53675: Sort existing test cases
23d2e8fc2 Bug #53675: Add tests for accountActivationDate
9646c7091 Bug #53675: debian/changelog entries
3c4b8c707 Bug #53675: Merge branch 'arequate/bug53675-accountActivationDate'

Package: ucs-school-lib
Version: 12.2.34A~4.4.0.202108291957
Branch: ucs_4.4-0
Scope: ucs-school-4.4

Package: ucs-test-ucsschool
Version: 6.0.241A~4.4.0.202108291959
Branch: ucs_4.4-0
Scope: ucs-school-4.4
Comment 3 Arvid Requate univentionstaff 2021-08-29 22:02:14 CEST
54a04c5155 Bug #53675: Register ucr template for cron job
54ff7491eb Bug #53675: Advisory update
Comment 4 Felix Botner univentionstaff 2021-08-30 13:47:32 CEST
Some tests from 61_udm-users/40_udm_users_delayed_activation.py currently fail in UCS 4.4-8, see https://jenkins.knut.univention.de:8181/job/UCS-4.4/job/UCS-4.4-8/job/AutotestJoin/lastCompletedBuild/testReport/
Comment 5 Arvid Requate univentionstaff 2021-08-30 14:56:12 CEST
098bf10e43 | fixup! Bug #53631: Register ucr template for cron job
473f6c8246 | Advisory update

I've also verified manually that the test case actually fails if the cron job is disabled:

ucr set --force directory/manager/user/accountactivation/cron="# "
pytest /usr/share/ucs-test/61_udm-users/40_udm_users_delayed_activation.py -k test_disabled_user_creation_activation
Comment 6 Daniel Tröder univentionstaff 2021-08-31 11:12:29 CEST
IMHO it's common practice to discuss API changes with the team maintaining a library. Proposed changes can be discussed and (p)reviewed in a git branch.

Please move the commits to a branch and revert them in main.
Then contact the UCS@school team to discuss the intended API change.
Comment 7 Arvid Requate univentionstaff 2021-09-02 12:58:38 CEST
Addressed via https://forge.univention.org/bugzilla/show_bug.cgi?id=53718#c8
Comment 8 Florian Best univentionstaff 2021-09-09 12:16:51 CEST
REOPEN: The test case 86_selenium.153_udm_check_properties_of_copied_users fails:
https://jenkins.knut.univention.de:8181/job/UCS-4.4/job/UCS-4.4-8/job/AutotestJoin/lastCompletedBuild/SambaVersion=no-samba,Systemrolle=master-part-II/testReport/86_selenium/153_udm_check_properties_of_copied_users/master090/

We are seeing a JavaScript exception during copying the object:

dojo.js.uncompressed.js:6665 TypeError: Cannot read property 'replace' of null
    at Object.replace (dojo.js.uncompressed.js:3192)
    at Object.process (Template.js:190)
    at Object.<anonymous> (Template.js:175)
    at Object.forEach (dojo.js.uncompressed.js:4263)
    at Object.getNewVal (Template.js:174)
    at Object.<anonymous> (Template.js:211)
    at Object.forIn (dojo.js.uncompressed.js:18458)
    at Object._constructor (Template.js:145)
    at Object.<anonymous> (Template.js:123)
    at dojo.js.uncompressed.js:2971

When trying to save the object then we get the pop up error message:

Die folgenden Eigenschaften konnten nicht validiert werden:
Benutzerkonto aktivieren am: Keine gültige Zeitangabe
Comment 9 Florian Best univentionstaff 2021-09-09 12:25:49 CEST
git:ecbcf27158d5d30ddfc0995a2e465fbba0f54f93 also changes TimeString.size to 'OneThird' for all widgets. This breaks displaying with smaller screens.
Comment 10 Florian Best univentionstaff 2021-09-09 12:55:24 CEST
The reason is the default value and the templating mechanism, which is used by the copy functionality. Probably setting a user template also fails similar:
We are setting the default value:
default=[[None, '00:00', tzlocal.get_localzone().zone], []],

where None is an invalid value.
The default value in this case is valid with the following type definition:
# default=(template-str, [list-of-required-properties])
# default type: Tuple[str, List[str])

From python side we don't run into errors, but we run into error on Javascript side then.

So None is not allowed, while an empty string would be allowed.
But the Date and Time javascript widgets only accept null and not empty strings.
And the backend syntax classes also don't accept empty strings and cause python tracebacks then.
Comment 11 Florian Best univentionstaff 2021-09-09 13:11:33 CEST
What we want to achieve with the default value here is that it does not set any default value: The default should be empty.

I will fix that by:
* removing the default
* allow the (sub) syntax classes to have empty values, so that it adds empty values as first item.
* make sure that DateBox can handle empty strings and returns NULL to the backend
* make sure that TimeBox can handle empty strings and returns NULL to the backend
* to be future proof the JS template mechanism should be able to also handle None instead of only strings and it must be able to handle arrays as complex syntax consists of them
Comment 12 Florian Best univentionstaff 2021-09-09 14:05:16 CEST
All points addressed in:

univention-web.yaml
d81ef357567f | Bug #53675: fix copying user object

univention-web (3.0.6-11)
d81ef357567f | Bug #53675: fix copying user object

univention-management-console-module-udm.yaml
d81ef357567f | Bug #53675: fix copying user object

univention-management-console-module-udm (9.0.15-11)
d81ef357567f | Bug #53675: fix copying user object

univention-directory-manager-modules (14.0.20-18)
d81ef357567f | Bug #53675: fix copying user object
Comment 13 Florian Best univentionstaff 2021-09-09 19:12:38 CEST
(In reply to Florian Best from comment #2)
> > c7c5078800 | Add cron based account activation
> REOPEN: cron jobs should test if the scripts to be called exists and
> otherwise do nothing. Otherwise a email is send if we remove this script
> somewhen but the cron config files is kept.

This is not yet implemented.
Comment 14 Johannes Keiser univentionstaff 2021-09-10 12:53:29 CEST
Created attachment 10818 [details]
TwoThirds DateBox

ecbcf27158d5d30ddfc0995a2e465fbba0f54f93 adjusts size for all DateBox widgets to TwoThirds

This does not look good in e.g. users/user
Comment 15 Florian Best univentionstaff 2021-09-10 18:41:45 CEST
(In reply to Florian Best from comment #13)
> (In reply to Florian Best from comment #2)
> > > c7c5078800 | Add cron based account activation
> > REOPEN: cron jobs should test if the scripts to be called exists and
> > otherwise do nothing. Otherwise a email is send if we remove this script
> > somewhen but the cron config files is kept.
> 
> This is not yet implemented.

univention-directory-manager-modules (14.0.20-18)
5e6925063fc8 | Bug #53675: add -executable condition to cronjob


(In reply to Johannes Keiser from comment #14)
> Created attachment 10818 [details]
> TwoThirds DateBox
> 
> ecbcf27158d5d30ddfc0995a2e465fbba0f54f93 adjusts size for all DateBox
> widgets to TwoThirds
> 
> This does not look good in e.g. users/user

univention-directory-manager-modules (14.0.20-18)
38ff65b9cdd1 | Bug #53675: fix sizing of ActivationDateTimeTimezone without influencing all other properties
Comment 16 Florian Best univentionstaff 2021-09-10 19:07:59 CEST
*** Bug 48904 has been marked as a duplicate of this bug. ***
Comment 17 Florian Best univentionstaff 2021-09-13 13:30:35 CEST
Fixed also Bug #53631 comment 13
0f4b3405614f | Bug #53675: fix errors due to missing syntax classes during errata upgrades
Comment 18 Florian Best univentionstaff 2021-09-14 17:31:52 CEST
5ca04f47447b | Bug #53675: [users/user]: apply isort
b1d0e5704e38 | Bug #53675: enable crontab every 15 minutes
d62d49d81147 | Bug #53675: only set accountActivationDate if all fields are specified
825f9f24ecd7 | Bug #53675: set local timezone as default value of accountActivationDate
Comment 19 Erik Damrose univentionstaff 2021-09-15 15:59:07 CEST
The remaining open points were addressed.
Automatic and manual tests as described in bug 53631 comment 9 successful
Verified