Bug 57239 - Import is activating deactivated (disabled) users
Import is activating deactivated (disabled) users
Status: NEW
Product: UCS@school
Classification: Unclassified
Component: Import scripts
UCS@school 5.0
Other Linux
: P5 normal (vote)
: ---
Assigned To: UCS@school maintainers
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2024-04-29 10:53 CEST by Jürn Brodersen
Modified: 2024-04-29 16:26 CEST (History)
1 user (show)

See Also:
What kind of report is it?: Security Issue
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: 4.8 (CVSS:4.0/AV:A/AC:L/AT:N/PR:H/UI:N/VC:L/VI:L/VA:L/SC:L/SI:L/SA:N)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jürn Brodersen univentionstaff 2024-04-29 10:53:21 CEST
Importing a user as deactivated (disabled) that is already deactivated results in it unexpectedly being activated.

I suspect this line: https://git.knut.univention.de/univention/ucsschool/-/blob/5.0/ucs-school-import/modules/ucsschool/importer/mass_import/user_import.py?ref_type=heads#L382

How to reproduce:

Create config:

root@primary:/usr/share/ucs-school-import/scripts# cat /tmp/ucs-school-testuser-import-deactivate.json 
{
	"csv": {
		"mapping": {
			"Schulen": "schools",
			"Benutzertyp": "__role",
			"Vorname": "firstname",
			"Nachname": "lastname",
			"Klassen": "school_classes",
			"Beschreibung": "description",
			"Telefon": "phone",
			"EMail": "email",
			"disabled": "disabled"
		}
	},
	"scheme": {
		"record_uid": "<firstname>.<lastname>",
		"username": {
		    "default": "<:umlauts><firstname>.<lastname><:lower>[COUNTER2]"
		}
	},
	"source_uid": "TESTID",
	"verbose": false,
	"normalize": {
		"firstname": false,
		"lastname": false
	}
}

Create csv:
./ucs-school-testuser-import --nostart --csvfile deactivate.csv --students 2 --inclasses 1 --classes 1 import

Add "disabled" row to the csv file with value "1"

Import users:

./ucs-school-user-import --conffile /tmp/ucs-school-testuser-import-deactivate.json --infile deactivate.csv -s import

The new users should be marked as disabled.

Import again:

./ucs-school-user-import --conffile /tmp/ucs-school-testuser-import-deactivate.json --infile deactivate.csv -s import

The users are now activated