Commit Graph

40 Commits

Author SHA1 Message Date
Akihiro Motoki cd7c1b5110 Address RemovedInDjango40Warning (2)
django.utils.translation.ugettext(), ugettext_lazy(), ugettext_noop(),
ungettext(), and ungettext_lazy() are deprecated in favor of the
functions that they’re aliases for: django.utils.translation.gettext(),
gettext_lazy(), gettext_noop(), ngettext(), and ngettext_lazy().

https://docs.djangoproject.com/en/4.0/releases/3.0/#id3

Change-Id: I77878f84e9d10cf6a136dada81eabf4e18676250
2022-02-04 16:22:07 +09:00
Akihiro Motoki be12ce1e96 Support Django 3.0 and 3.1 support (2)
It seems Django 3.0+ does not allow to set an unknown attribute
to forms.Form.fields. "keyOrder" attribute has no meaning and
"field_order" of the Form class is the right way to configure
the order of fields.

Change-Id: Ib3a631a3626977a2e7114dac217aacd523354c53
2021-09-14 19:32:23 +00:00
Akihiro Motoki e5d09edc20 Use python3-style super()
In python3, super() does not always require a class and self reference.
In other words, super() is enough for most cases.
This is much simpler and it is time to switch it to the newer style.

pylint provides a check for this.
Let's enable 'super-with-arguments' check.

NOTE: _prepare_mappings() method of FormRegion in
openstack_dashboard/test/integration_tests/regions/forms.py is refactored.
super() (without explicit class and self referece) does not work when
a subclass method calls a same method in a parent class multiple times.
It looks better to prepare a separate method to provide a common logic.

Change-Id: Id9512a14be9f20dbd5ebd63d446570c7b7c825ff
2020-10-15 14:37:20 +09:00
Akihiro Motoki 692778f8cf pylint: Address no-else-return warning
This pylint check 'no-else-return' might be debatable.
but as far as I checked it works in most cases.

Change-Id: Ie8574d4a529454c6e050fa62a7a17ea097d00240
2020-09-27 12:44:16 +09:00
Zuul 49df5cffd8 Merge "Avoid stripping leading/traling spaces in password forms" 2020-09-03 16:41:24 +00:00
Ivan Kolodyazhny ee6fa9a245 Remove Keystone v2 related code
Kyestone V2 support was removed in Train, so it's safe to do such cleanup.

* Functions which just return horizon settings are dropped and
  the settings are referred directly now.
* The service catalog in the sample test data is updated to match
  the format of the keystone API v3.
* Related to the above change of the sample service catalog,
  openstack_dashboard.test.unit.api.test_keystone.ServiceAPITests is
  updated to specify the region name explicitly because 'RegionTwo'
  endpoint is no longer the second entry of the endpoint list in the
  keystone API v3.

Co-Authored-By: Akihiro Motoki <amotoki@gmail.com>
Change-Id: Ib60f360c96341fa5c618595f4a9bfdfe7ec5ae83
2020-04-23 11:43:12 +09:00
vmarkov 7f849239ea Support for Keystone password_lock option
This feature was added in Keystone V3 API. Proposed patch adds support
to Horizon

Co-Authored-By: Ivan Kolodyazhny <e0ne@e0ne.info>
Closes-bug: #1766485
Change-Id: Ic20a58c76826d703b43fa6a2d77ae5f77dcda1f4
2020-04-10 13:22:53 +03:00
Akihiro Motoki 6a07f5a5b4 Avoid stripping leading/traling spaces in password forms
There are cases where leading/trailing spaces are included in passwords
We should not touch passwords input in forms and pass them to auth
backends without any modifications. The detail was discussed in
the mailing list thread [1] referred in the bug comment.

[1] http://lists.openstack.org/pipermail/openstack-discuss/2020-January/thread.html#12223

Change-Id: I98de224cc77a98fa216ec3bc032412325e661e14
Closes-Bug: #1861224
2020-02-05 14:41:49 +09:00
Zuul 47af2decae Merge "Display password_regex_description when password change fails" 2019-08-21 15:12:03 +00:00
Radomir Dopieralski 8f5a3cd7da Display password_regex_description when password change fails
When keystone has password_regex set and the new password doesn't match
it, the attempt to change the password will fail, and keystone will
helpfully include password_regex_description in its error message.
Unfortunately Horizon discards that and displays "Unable to update the
user password.", which is considerably less helpful.

This change extracts the description from the error message in this
case, and displays it to the user together with a translated error
message. Unfortunately we have no way of also translating the
description.

Closes-bug: #1838003
Change-Id: I535c020deed76188c0f7150072fbdced9c5454fc
2019-08-13 13:46:08 +02:00
Akihiro Motoki 8653f718f2 Define default settings explicitly (openstack_dashboard 4/5)
This commit mainly covers settings
in openstack_dashboard/dashboards/identity/.

Part of blueprint ini-based-configuration
Change-Id: Ibb174f62d0047a10b2832dd2ff350f5f32955b08
2019-07-05 14:49:11 +09:00
manchandavishal 0f2df76233 Modify the success message of 'Edit' user information
This patch add user name in success meassage
when 'Edit' a user information.

Change-Id: Ic43952c1388a055863a76719f239f9a6d1176fc1
Closes-Bug: #1817887
2019-03-12 09:33:51 +00:00
Akihiro Motoki f3bd271fc9 pylint: fix bad-super-call
Change-Id: Ia81e5c8b77dbfcb48630b1736d581cdff73278ef
2019-01-15 01:11:33 +09:00
Marek Lycka 8840fdbdd3 Orders the projects and roles in user creation combos
Sorts the available project and role names in the Primary
Project and Roles combos respectively when creating a new
user through the identity dashboard/create user dialog.

Change-Id: Ia488d598727dfc11ec4b8bc7f8f2fd3f6aa7fde6
Closes-Bug: 1713497
Co-Authored-By: Ales Krivak <ales.krivak@ultimum.io>
2018-01-12 08:48:23 +01:00
Lucas H. Xu a9517ff615 Fix cannot delete user's email addresses in the identity/user panel
How to reproduce the bug:

P.S. Using the horizon master(pike) codebase

1) Login as an admin user
2) Click Identity and go to the Users panel
3) Create a user and put an email address with that user
4) Then edit this user to clear the email address.
5) Update the user and even though we have a green  banner(successful)
show up, the email address still viewable and do not disappear.

Closes Bug: #1573479

Change-Id: I0273d0c6d885c77f1f74bdc2ae6674d1e6539ac0
2017-08-09 16:30:46 -04:00
wei.ying 5d8c8fb85b Fix unauthorized exception in users panel
If a member role user login and use admin to get keystoneclient,
but he is not a super user, then a notAuthorized exceptions will be raised,
it seems to be unreasonable.

The following actions will throw unauthorized exception.

Go to Users panel, Click user name , Click Change Password,
Submit Change Password form.

Change-Id: I4f6486b92f023ad0daecfff51e3a1ed16b0e78c0
Closes-Bug: #1684475
2017-04-30 06:11:43 +08:00
Gábor Antal 34a3aa0ba8 Handle log message interpolation by the logger
According to OpenStack Guideline[1], logged string message should be
interpolated by the logger.

[1]: http://docs.openstack.org/developer/oslo.i18n/guidelines.html#adding-variables-to-log-messages
Change-Id: I51f50935f1eeffe4960562d6309dfdf05814e595
Closes-Bug: #1596829
2017-03-31 20:59:16 +09:00
Akihiro Motoki baa4ca8dce hacking: noqa cleanup in openstack_dashboard
attribute-level imports are not checked by hacking module now.
most noqa is used to disable warnings on attribute-level imports.
This commit drops noqa for this purpose.

After this, there are only 3 noqa under openstack_dashboard/ :)

Change-Id: I4a449802f5dbd6e44e4b8b5c378a555d47d9a99f
2017-03-17 19:38:47 +00:00
Jenkins cad32c5f58 Merge "modified condition variable project_choices" 2016-12-09 02:12:25 +00:00
Kenji Ishii ab11eef92a Supports extra properties in project and user
This change is to support extra properties in project and user.
To show an extra property in project/user table, you can customize.
The explanation of the method to add an extra property is added
by this patch.
In addition, when you do a create or update user, you can specify a
value of extra property by setting in local_settings.py

Change-Id: Ifee491f2a55d9207fe5da70136f749e1fc4bab82
Implements: blueprint support-extra-prop-for-project-and-user
2016-08-21 22:13:35 +09:00
Diana Whitten 47d9c33dcd Horizon selects are now themable: Identity Panels
Horizon was using a standard select input. Unfortunately, this type
of input is only customizable to a small extent.

Co-Authored-By: Matthew Wood <woodm1979@gmail.com>
Co-Authored-By: Brian Tully <brian.tully@hp.com>

Change-Id: If2e17ddef448f4867755280296a35e9fd9e8f4fc
Partially-implements: blueprint horizon-theme-css-reorg
2016-06-02 09:09:51 -07:00
Adriano Fialho 16b58d2fe6 modified condition variable project_choices
the error was in condition "if > 1", which was allowing
the default value only when the list had two or more values.

Change-Id: If2ce5a5a3cb5f6411df0c023a818f20fa2130768
Closes-Bug: #1581635
2016-05-23 07:29:23 -03:00
David Lyle 32510d8211 Fixing updating user with no default project
The selector for setting the default project passes on an empty string
if the value is not changed. This is causing an error from keystone as
an empty string is not a valid project ID.

To fix, a couple of things have been done:

First, as user_update is a PATCH, we no longer pass on the default
project as a parameter in the update when using keystone v3
and the value did not change when editing the user.

Second, there is currently no way to unset the default project
using keystoneclient. An entry in the default project select
"select a project" has been removed when the default project is
already set. The entry was selectable and resulted in the
problematic empty string. The current default project is already
selected at load time. The ability to select a different default
project is maintained.

Additionally, keystone v2.0 functionality is not effected, as the
default project id is required in v2.0.

A test was added to cover the case of editing the default project.

Closes-Bug: #1561612
Change-Id: I3c84ee5c7af846b5a58f2dd0342a537d312323cf
2016-03-24 20:46:28 -06:00
daniel-a-nguyen 2b846515f3 Retrieve domain scoped token
This patch supports using domain scoped tokens against keystone v3.

Use Cases:

Cloud Admin - view and manage identity resources across domains
Domain Admin - view and manage identity resources in the domain logged in
User - view identity project in the domain logged in

Regression:

Supports keystone v2 through local_settings.py configuration
Supports keystone v3 with multidomain = False
Supports keystone v3 with mulitdomain = True

Relates to https://review.openstack.org/#/c/141153/

Background on how to test is here
https://wiki.openstack.org/wiki/Horizon/DomainWorkFlow

Co-Authored-By: Brad Pokorny <Brad_Pokorny@symantec.com>
Co-Authored-By: Brian Tully <brian.tully@hp.com>
Co-Authored-By: Michael Hagedorn <mike.hagedorn@hp.com>
Co-Authored-By: woomatt <matt.wood@hp.com>

Partially Implements: blueprint domain-scoped-tokens

Closes-Bug: #1413851
Change-Id: Iaa19bfef9b0c70304ff81d083c62b218b2d02479
2016-03-08 15:17:38 -08:00
Rob Cresswell 83c9e3fead Remove all pre-Django 1.8 workarounds
This patch removes all code workarounds in Horizon for Django versions
before 1.8. As a bonus, this means an extra unit test is run that was
previously skipped.

Change-Id: I63f56953d9beefd3ea596d3e31c6032e936b140c
Partially-Implements: blueprint drop-dj17
2016-01-24 22:12:02 +00:00
Itxaka 534a93f7c3 Do not use empty description fields
When editing the user by the user Update Form
make sure that if the description field has not changed
to not send it, as it will be saved as empty string.
Instead, the value should be absent from the user object,
so it respects the same values as users created in keystone
directly.
Unfortunately, inline editing still triggers the issue
as there is no good way of checking the initial value
without making an extra call.

Change-Id: Id2e0b3c589855068cbc15adc75b57ff0bf61a1b9
Partial-Bug: 1519579
2015-12-04 09:23:21 +01:00
David Lyle 49f9d15488 Update default_project param on create user
In keystone v3, the parameter to create user for the the default project
has changed from project to default_project and is no longer honored and
throws an exception. Also passing in '' rather than None causes keystone
issues, so moving to None.

Closes-Bug: #1478143
Change-Id: I73423433a42bf46769065a269a3c35f27175f185
2015-07-27 10:34:26 -06:00
Masco Kaliyamoorthy 3d9372a8c5 Added 'enabled' option in create user form
In create user form, no way to set the user is disabled.
by default it is setting the user as enabled.

This patch adding the Boolean field to set enable and disable the user
at the time creating.

Change-Id: If4bf8ef077326658d4693858144904c7a93f1eb5
Closes-Bug: #1468208
2015-06-29 11:02:29 +05:30
Canh Truong cbd63f27e4 Add description field in the user table
In the user table, description column is missing when using keystone V3
This patch add the 'Description'column in User table. This also
change to add 'Description' field the user_create and user_update form.

Change-Id: I90bb7a644f8f29ae0055c6c2ffc688a9b709f300
Closes-Bug: #1463247
2015-06-24 11:22:22 +07:00
Timur Sufiev d2f9b6604c Fix Create User form's fields sorting for Django 1.7
Starting from Django 1.7 self.fields.keyOrder no longer works for
setting fields ordering, need to rearrange fields there by recreating
underlying OrderedDict.

Change-Id: If0f4c7014a7a68f2ff0d0f2cb06f7b1c2e28436b
Closes-Bug: #1465221
2015-06-15 17:04:06 +03:00
Dimitri Mazmanov 21d155395c Fix the redundant error message during user create
Simply check if both password and confirm_password fields are not empty.

Change-Id: Ie04e0515f15993ed3f693d107475939604e55310
Closes-Bug: #1445043
2015-04-20 13:04:33 +02:00
Cindy Lu 4198cbf87d Double check admin password when update user password
Add a new setting to enable a new textbox field on the Change
Password form that will double check the logged-in Admin
user's password.

For example if the logged-in admin leaves an unattended computer,
someone can change the password of the logged in user successfully.

Co-Authored-By: Steve Martinelli <stevemar@ca.ibm.com>

Change-Id: Icafa8ce8ab30ec43d3f6419a77118a634a163870
Closes-Bug: #1387372
2015-03-09 17:43:29 -07:00
Cindy Lu 9620cbac91 move Users Edit Password into separate form
Based on inline TODO comment.
Code refactor.
Fix unused test case (was not used as helper method and
was not prefixed with 'test_' so it was not used).

Change-Id: Ie696970b4b61d699cc4afa5174248df6c00c688d
Closes-Bug: #1402047
2015-02-18 17:50:20 -08:00
Yash Bathia 0dc91bed5c Creating a new user with an existing user name
Change error message when we create a new user
with an existing user name.

Change-Id: I795c04672a3c625be074c8af78eb169436ac3895
Closes-Bug: #1404432
2014-12-19 22:54:49 -08:00
Vlad Okhrimenko 95db4eb709 Renaming a user name with an existing user name
Change error message when we try rename user
name with an existing user name.

Change-Id: I2dbf9fee3c682a70c77544a8dd6b925311a3f019
Closes-Bug: #1389132
2014-11-24 11:53:04 +02:00
Jenkins 20b1c189b5 Merge "Restrict the length of user name input" 2014-10-17 13:00:33 +00:00
Akihiro Motoki 832a741c88 Fix E128 errors in remaining openstack_dashboard/
E128 continuation line under-indented for visual indent

Closes-Bug: #1375929
Change-Id: I2a72313d359bdfe2e2667eba5d3bf9744ec8f60a
2014-10-16 16:53:52 +09:00
Zhenguo Niu a696e5992e Restrict the length of user name input
When updating users, user name should not be greater than 255.

Change-Id: Icf99fc2adec8d3a044cca4486f332593a91474fa
Closes-Bug: #1279579
2014-10-16 11:40:50 +08:00
Sam Betts e79af0ac1e Allow forms to disable autofill in all browsers
New variable added to form to specify whether it should autofill or
not. This updates the modal forms autocomplete attribute. Hidden
fields are required because Chromium v34+ based browsers ignore the
autocomplete=off form attribute, so the hidden fields catch autofill
data. Any form without self.no_autocomplete = True will just act
like before.

Change-Id: Ibb1722023eea8f57312e1133939d1f75cd909467
Closes-Bug: 1352459
2014-09-02 15:26:39 +00:00
David Lyle 18e8ea810d Separating Identity Dashboard and using RBAC
Moving identity panels to their own dashboard.

RBAC is now used to determine the data to load in the identity
dashboard. Using the default policy file, a user with role member
will now be able to see their project list.

Also, adding a policy check mechanism at the panel and dashboard
level to determine which panels and dashboards the user can access.

Implements blueprint separate-identity-dash

Change-Id: I7ebfec2bf6e44899bec79d3b23c90d56a976200f
2014-08-18 16:40:56 -06:00