From a090b429fda35c5a9c3cfb672ab42a5985d00ff9 Mon Sep 17 00:00:00 2001 From: Petr Vobornik Date: Mon, 8 Jun 2020 19:27:30 +0200 Subject: [PATCH] baseuser: fix ipanthomedirectorydrive option name It should be ipanthomedirectorydrive and not ipanthomedirectoryrive. This fixes showing the field in Web UI and also should fix CLI as it probably never worked. Signed-off-by: Petr Vobornik Reviewed-By: Alexander Bokovoy --- API.txt | 8 ++++---- ipaserver/plugins/baseuser.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/API.txt b/API.txt index 5354a33a0..300b3d9b1 100644 --- a/API.txt +++ b/API.txt @@ -5085,7 +5085,7 @@ option: Str('in_role*', cli_name='in_roles') option: Str('in_sudorule*', cli_name='in_sudorules') option: Str('initials?', autofill=False) option: Str('ipanthomedirectory?', autofill=False, cli_name='smb_home_dir') -option: StrEnum('ipanthomedirectoryrive?', autofill=False, cli_name='smb_home_drive', values=[u'A:', u'B:', u'C:', u'D:', u'E:', u'F:', u'G:', u'H:', u'I:', u'J:', u'K:', u'L:', u'M:', u'N:', u'O:', u'P:', u'Q:', u'R:', u'S:', u'T:', u'U:', u'V:', u'W:', u'X:', u'Y:', u'Z:']) +option: StrEnum('ipanthomedirectorydrive?', autofill=False, cli_name='smb_home_drive', values=[u'A:', u'B:', u'C:', u'D:', u'E:', u'F:', u'G:', u'H:', u'I:', u'J:', u'K:', u'L:', u'M:', u'N:', u'O:', u'P:', u'Q:', u'R:', u'S:', u'T:', u'U:', u'V:', u'W:', u'X:', u'Y:', u'Z:']) option: Str('ipantlogonscript?', autofill=False, cli_name='smb_logon_script') option: Str('ipantprofilepath?', autofill=False, cli_name='smb_profile_path') option: Str('ipatokenradiusconfiglink?', autofill=False, cli_name='radius') @@ -5147,7 +5147,7 @@ option: Str('givenname?', autofill=False, cli_name='first') option: Str('homedirectory?', autofill=False, cli_name='homedir') option: Str('initials?', autofill=False) option: Str('ipanthomedirectory?', autofill=False, cli_name='smb_home_dir') -option: StrEnum('ipanthomedirectoryrive?', autofill=False, cli_name='smb_home_drive', values=[u'A:', u'B:', u'C:', u'D:', u'E:', u'F:', u'G:', u'H:', u'I:', u'J:', u'K:', u'L:', u'M:', u'N:', u'O:', u'P:', u'Q:', u'R:', u'S:', u'T:', u'U:', u'V:', u'W:', u'X:', u'Y:', u'Z:']) +option: StrEnum('ipanthomedirectorydrive?', autofill=False, cli_name='smb_home_drive', values=[u'A:', u'B:', u'C:', u'D:', u'E:', u'F:', u'G:', u'H:', u'I:', u'J:', u'K:', u'L:', u'M:', u'N:', u'O:', u'P:', u'Q:', u'R:', u'S:', u'T:', u'U:', u'V:', u'W:', u'X:', u'Y:', u'Z:']) option: Str('ipantlogonscript?', autofill=False, cli_name='smb_logon_script') option: Str('ipantprofilepath?', autofill=False, cli_name='smb_profile_path') option: Str('ipasshpubkey*', autofill=False, cli_name='sshpubkey') @@ -6185,7 +6185,7 @@ option: Str('in_role*', cli_name='in_roles') option: Str('in_sudorule*', cli_name='in_sudorules') option: Str('initials?', autofill=False) option: Str('ipanthomedirectory?', autofill=False, cli_name='smb_home_dir') -option: StrEnum('ipanthomedirectoryrive?', autofill=False, cli_name='smb_home_drive', values=[u'A:', u'B:', u'C:', u'D:', u'E:', u'F:', u'G:', u'H:', u'I:', u'J:', u'K:', u'L:', u'M:', u'N:', u'O:', u'P:', u'Q:', u'R:', u'S:', u'T:', u'U:', u'V:', u'W:', u'X:', u'Y:', u'Z:']) +option: StrEnum('ipanthomedirectorydrive?', autofill=False, cli_name='smb_home_drive', values=[u'A:', u'B:', u'C:', u'D:', u'E:', u'F:', u'G:', u'H:', u'I:', u'J:', u'K:', u'L:', u'M:', u'N:', u'O:', u'P:', u'Q:', u'R:', u'S:', u'T:', u'U:', u'V:', u'W:', u'X:', u'Y:', u'Z:']) option: Str('ipantlogonscript?', autofill=False, cli_name='smb_logon_script') option: Str('ipantprofilepath?', autofill=False, cli_name='smb_profile_path') option: Str('ipatokenradiusconfiglink?', autofill=False, cli_name='radius') @@ -6250,7 +6250,7 @@ option: Str('givenname?', autofill=False, cli_name='first') option: Str('homedirectory?', autofill=False, cli_name='homedir') option: Str('initials?', autofill=False) option: Str('ipanthomedirectory?', autofill=False, cli_name='smb_home_dir') -option: StrEnum('ipanthomedirectoryrive?', autofill=False, cli_name='smb_home_drive', values=[u'A:', u'B:', u'C:', u'D:', u'E:', u'F:', u'G:', u'H:', u'I:', u'J:', u'K:', u'L:', u'M:', u'N:', u'O:', u'P:', u'Q:', u'R:', u'S:', u'T:', u'U:', u'V:', u'W:', u'X:', u'Y:', u'Z:']) +option: StrEnum('ipanthomedirectorydrive?', autofill=False, cli_name='smb_home_drive', values=[u'A:', u'B:', u'C:', u'D:', u'E:', u'F:', u'G:', u'H:', u'I:', u'J:', u'K:', u'L:', u'M:', u'N:', u'O:', u'P:', u'Q:', u'R:', u'S:', u'T:', u'U:', u'V:', u'W:', u'X:', u'Y:', u'Z:']) option: Str('ipantlogonscript?', autofill=False, cli_name='smb_logon_script') option: Str('ipantprofilepath?', autofill=False, cli_name='smb_profile_path') option: Str('ipasshpubkey*', autofill=False, cli_name='sshpubkey') diff --git a/ipaserver/plugins/baseuser.py b/ipaserver/plugins/baseuser.py index a0ed65874..e1b7763f0 100644 --- a/ipaserver/plugins/baseuser.py +++ b/ipaserver/plugins/baseuser.py @@ -420,7 +420,7 @@ class baseuser(LDAPObject): label=_('SMB Home Directory'), flags=['no_create'], ), - StrEnum('ipanthomedirectoryrive?', + StrEnum('ipanthomedirectorydrive?', cli_name='smb_home_drive', label=_('SMB Home Directory Drive'), flags=['no_create'], -- 2.26.2 From 691b3cddb275821630f443f22706fa75e7c7a5c8 Mon Sep 17 00:00:00 2001 From: Petr Vobornik Date: Mon, 8 Jun 2020 19:11:33 +0200 Subject: [PATCH] webui: hide user attributes for SMB services section if empty This section should be hidded if user object hasn't ipantuserattrs object class. I.e. when trusts are not enabled. Web UI framework already supports hidding of sections if the section contains no visible field. So to achieve it we simply needs to hide the fields. Given that attributelevelrights contains rights only for attributes of current object classes, all of these are regarded as not writable. We can leverage feature of input_widget that it gets hidden when the attribute is not writable and has no value and widget's "hidden_if_empty" is set to true. Thus doing it here. For this to work, it is also required to fix an issue with "ipanthomedirectorydrive" which is optional (in API) but Web UI doesn't offer "empty" ("") value. Adding it here. fixes: https://pagure.io/freeipa/issue/8336 Signed-off-by: Petr Vobornik Reviewed-By: Serhii Tsymbaliuk Reviewed-By: Alexander Bokovoy --- install/ui/src/freeipa/user.js | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/install/ui/src/freeipa/user.js b/install/ui/src/freeipa/user.js index fb626f2a1..8f1f5cd85 100644 --- a/install/ui/src/freeipa/user.js +++ b/install/ui/src/freeipa/user.js @@ -367,36 +367,39 @@ return { { name: 'smb_attributes', label: '@i18n:objects.smb_attributes.title', - show_cond: ['oc_ipantuserattrs'], fields: [{ name: 'ipantlogonscript', tooltip: { title: '@i18n:objects.smb_attributes.ipantlogonscript_tooltip' - } + }, + hidden_if_empty: true }, { name: 'ipantprofilepath', tooltip: { title: '@i18n:objects.smb_attributes.ipantprofilepath_tooltip' - } + }, + hidden_if_empty: true }, { name: 'ipanthomedirectory', tooltip: { title: '@i18n:objects.smb_attributes.ipanthomedirectory_tooltip' - } + }, + hidden_if_empty: true }, { name: 'ipanthomedirectorydrive', $type: 'select', options: IPA.create_options([ - 'A:', 'B:', 'C:', 'D:', 'E:', 'F:', 'G:', 'H:', 'I:', - 'J:', 'K:', 'L:', 'M:', 'N:', 'O:', 'P:', 'Q:', 'R:', - 'S:', 'T:', 'U:', 'V:', 'W:', 'X:', 'Y:', 'Z:' + '', 'A:', 'B:', 'C:', 'D:', 'E:', 'F:', 'G:', 'H:', + 'I:', 'J:', 'K:', 'L:', 'M:', 'N:', 'O:', 'P:', 'Q:', + 'R:', 'S:', 'T:', 'U:', 'V:', 'W:', 'X:', 'Y:', 'Z:' ]), tooltip: { title: '@i18n:objects.smb_attributes.ipanthomedirectorydrive_tooltip' - } + }, + hidden_if_empty: true } ] } @@ -482,7 +485,6 @@ return { IPA.user.self_service_other_user_evaluator, IPA.user.preserved_user_evaluator, IPA.user.is_locked_evaluator, - IPA.object_class_evaluator, IPA.cert.certificate_evaluator ], summary_conditions: [ -- 2.26.2