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

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