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

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