Blame SOURCES/0004-baseuser-fix-ipanthomedirectorydrive-option-name_rhbz#1851411.patch

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