Commit Graph

511 Commits

Author SHA1 Message Date
Thomas Goirand 8770753fcc Specify transform=repr in assertQuerysetEqual()
Previously "repr" was automatically applied to "qs" argument of
assertQuerysetEqual() and most horizon unittest behaviors assume it.
It was deprecated in Django 3.2 and removed in Django 4.1. We need to
specify transform=repr explicitly to use the existing behavior.

[1] https://docs.djangoproject.com/en/3.2/topics/testing/tools/#django.test.TransactionTestCase.assertQuerysetEqual

Closes-Bug: #2038474
Change-Id: Ie7c7e9a1efc492889639e25509c8e614268c1d26
2023-10-23 14:24:49 +09:00
Tatiana Ovchinnikova f044c4b0a3 Migrate to AngularJS v1.8.2
This patch aligns current code with AngularJS v1.8.2 requirements.

Change-Id: Ifdad18e805953957bfaa1b42908dfbbe8976dbcb
2022-06-08 15:43:13 -05:00
manchandavishal 65d748fb25 Deprecate Django based Panel for Images, Keypair, and roles
As discussed in the horizon meetings or in horizon PTG sessions,
horizon team agreed to deprecate django version of Images, Keypair
and Roles panel as we think that feature gaps between the two
implementations have been closed. Let's mark the Django version as
deprecated for all these panels and gather more attention
from operators.

Change-Id: I965f9dbdd5e78b52a788f73b359c1c6fbc18637e
2022-05-10 05:28:28 +09:00
Zuul 0798bdacd3 Merge "Add SYSTEM_SCOPE_SERVICES setting that hides panels" 2022-03-24 10:36:17 +00:00
Radomir Dopieralski 6c814b241d Add SYSTEM_SCOPE_SERVICES setting that hides panels
Since not all services are ready to use the system scope token,
we need a way to disable and enable the use of system scope
token on a per-service basis. This setting let us configure
which services should use the system scope token. By default
the list is empty and system scope token is not used at all.

Change-Id: I5e0cdc7288221571f183a37b800c19dc4cff5707
2022-03-10 15:13:21 +01:00
Zuul cf9a30d39e Merge "Address RemovedInDjango40Warning (3)" 2022-03-10 12:23:11 +00:00
Zuul dd9e4c82b5 Merge "Address RemovedInDjango40Warning (2)" 2022-03-03 10:14:04 +00:00
Akihiro Motoki d9266fd82c Address RemovedInDjango40Warning (3)
In Django 3.1, django.conf.urls.url() is deprecated
in favor of django.urls.re_path().

https://docs.djangoproject.com/en/4.0/releases/3.1/#id2

Change-Id: I484694f8718f61c022126a1935cf28fce075894b
2022-02-04 16:26:54 +09:00
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
manchandavishal a375c54186 Update default value of OPENSTACK_KEYSTONE_DEFAULT_ROLE
This patch update default value of OPENSTACK_KEYSTONE_DEFAULT_ROLE
to 'member' from '_member_'. If a user tries to create a new project now
it leads to "Could not find default role "_member_" in Keystone" error.

Also long time ago keystone-bootstrap changed the default member role
that is created to member from the legacy _member_ role. Any deployments
that might still be using _member_ should set this explicitly.

Closes-Bug: #1957173
Change-Id: I1fc7f44326b82ceb303f8d663ff0b42f0bdf7855
2022-01-17 11:21:31 +05:30
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
Vadym Markov c80d7e32ef Add POST/Redirect/GET for Domains dashboard
Currently, "Set Domain Context" and "Clear Domain Context" doesn't do
PRG, so page reload after these actions produce browser popup about form
re-submission. Proposed patch fixes it

Change-Id: I80d11cbdd42224456ee3a354ebad556a318ba03a
2021-07-27 13:12:24 +03:00
Pedro Kostelec ae7896cea5 Consisent abbreviation of size units
Most units (KB, MB, GB, TB, PB) are shown in an abbreviated format.
The exception were bytes, which where shown as "Bytes". This commit
resolves this inconsistency by showing "B" for byte units.

Change-Id: Ied94c777a70bf8955f5a328ffcb63d98a7a2befd
Closes-Bug: 1411595
Signed-off-by: Iago Estrela <hiagoestrelas@gmail.com>
2021-05-04 11:50:17 -03:00
Zuul 28e3fa5bee Merge "Use policy_rules for user role assignment and group tabs" 2021-03-29 20:51:07 +00:00
Zuul bbec512f1d Merge "Don't load user role assignment or groups tabs for non-admins" 2021-03-27 20:01:44 +00:00
Mark Goddard f0736c5174 Use policy_rules for user role assignment and group tabs
The policy_rules feature was added recently, which simplifies making
tabs allowed conditionally based on policy. Use the feature for the User
role assignments and groups tabs.

This is a separate commit to allow the original patch to be backported.

Related-Bug: #1920214
Change-Id: Ic4a16b27c4f2da0daa2ec066d129926c349d1e4b
2021-03-26 13:48:30 +00:00
Zuul 0b6ac97fcd Merge "handle missing access_rules" 2021-03-23 11:55:49 +00:00
Mark Goddard 60cf320315 Don't load user role assignment or groups tabs for non-admins
As a non admin user, navigate to Identity -> Users. Then click on the
username of your user to go to the detail page.

Only the allowed Overview tab is visible.

The view shows three tabs: Overview, Role assignments, Groups. Click on
either Role assignments or Groups. An error will appear, showing that
the API call is unauthorised, and the table content will fail to load.

This change fixes the issue by conditionally loading the tabs based on
policy.

Closes-Bug: #1920214
Change-Id: Ic8b723e6fd423b96a4f5eff54f9392cee534ed9e
2021-03-19 15:14:04 +00:00
Lars Kellogg-Stedman dadd45adda handle missing access_rules
we delete the "access_rules" field from the form if keystone API
version is less than 3.13, but we don't consider the case in
clean() method. We are in Wallaby development cycle and we support
N-4 release for upgrade [1]. This means horizon can run with Stein
keystone. Pre-3.13 keystone API (i.e., 3.12) is part of Stein
release [2], so it makes sense to consider this condition.

[1] https://docs.openstack.org/horizon/latest/contributor/policies/supported-software.html
[2] https://docs.openstack.org/api-ref/identity/

Co-Authored-By: Akihiro Motoki <amotoki@gmail.com>
Change-Id: I02e124d90f99d400d8c59bff2c563fdc85e624d4
2021-03-18 12:51:52 +09:00
YuehuiLei 87f498bee5 Drop the usage of unicode prefix from unicode strings
All strings are considered as unicode strings in python 3,
so we no longer need "u" prefix (u'...').

Co-Authored-By: Akihiro Motoki <amotoki@gmail.com>
Change-Id: I796d2fcdca066475bbf29d25cbf2aa67b2b2178b
2021-02-12 13:05:27 -06:00
Tatiana Ovchinnikova 5c45c8825e Add expectations to identity specs
The last bunch of "spec has ho expectations" warnings is fixed
for the latest Jasmine. The option failSpecWithNoExpectations
is set to true now.

Related-Bug: #1894127

Change-Id: I87d6a3e0a21eb8f3e5a548d7fdd0ae01bbda54e1
2020-12-18 10:22:57 -06:00
Akihiro Motoki c45cc6b1c5 Drop the usage of nova extensions in python code
Part of the removal of OPENSTACK_NOVA_EXTENSIONS_BLACKLIST (1/3)

All references of nova extensions in the python code are cleaned up.
Note that the API layer is not touched yet as it is used by the
JavaScript side.

Change-Id: I66cd0a9629253a6462aace9902ef8200b94b2a21
2020-10-27 20:00:45 +09:00
Zuul f90c3cd501 Merge "Use python3-style super()" 2020-10-27 04:42:53 +00:00
Zuul c8d92aebb1 Merge "pylint: Address no-else-return warning" 2020-10-26 11:15:25 +00:00
Zuul abcbb0dea8 Merge "pylint: Address no-else-continue/no-else-raise warnings" 2020-10-19 18:39:47 +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
Zuul e3dd5a02d9 Merge "Make text download and load groups tests work" 2020-10-12 14:03:01 +00:00
Walter Doekes 612942bdf7
users: Correct lock_password status visibility (Yes/No) in user details
Before this change, it would always say No, regardless of actual
setting.

Change-Id: Ib30d818ecae7b8edd33e94ad2c3c0e2ad8e01822
Closes-Bug: #1897269
2020-10-06 10:13:07 +02: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
Akihiro Motoki b67ad564c4 pylint: Address no-else-continue/no-else-raise warnings
Change-Id: I1d44c1bf564cf02908113a42b98e06057e993ec7
2020-09-27 12:44:16 +09:00
Zuul fb13427c78 Merge "Make identity tests work" 2020-09-24 02:58:30 +00:00
Tatiana Ovchinnikova 533892f080 Make text download and load groups tests work
Currently "then" callback functions for these tests aren't called since
digest cycles were never triggered. Jasmine Spec Runner marks them 'passed'
only adding "SPEC HAS NO EXPECTATIONS" into their names.
This patch triggers a digest by calling a scope's $apply functions in a
correct place, deals with timeout properly and makes the tests work.

Closes-Bug: #1894127

Change-Id: I00acc4b13fa0cc05b8c6ccd2024084527562f001
2020-09-22 14:35:17 -05:00
Tatiana Ovchinnikova 97aa7532e8 Make identity tests work
Identity JS tests have no output expectations but Jasmine Spec Runner marks
them 'passed' only adding "SPEC HAS NO EXPECTATIONS" into the tests names.
This patch adds callbacks to make tests asynchronous and fix it.

Partial-Bug: #1894127

Change-Id: I6c10c49b6a6aaee2fded8c3ef02f858208bc31b4
2020-09-09 13:55:06 -05:00
Zuul 467b218810 Merge "Cleanup for Refactor-error-messages" 2020-09-08 16:32:43 +00:00
manchandavishal be461acd6f Cleanup for Refactor-error-messages
This patch is a clean-up patch for refactor-error-messages bp
which remove the exception message from base message otherwise
the same exception message display twice like
this https://ibb.co/XyFWMdz .

Partially-Implements blueprint refactor-error-messages

Change-Id: I46b632dbb6701785e7d654feff336a27d6ecea9c
2020-09-04 10:39:11 +00:00
Zuul 49df5cffd8 Merge "Avoid stripping leading/traling spaces in password forms" 2020-09-03 16:41:24 +00:00
Kieran Spear 84355d453c Fix display of application credential roles
On the application credentials index page the roles
are displayed as a python list: "[b'_member']".

This changes that to be properly comma-separated.

Closes-bug: #1878741
Change-Id: Idfbba05091b563957162b6cb58c2475f9594b0c2
2020-05-15 16:43:20 +10:00
Walter Doekes 941f64915e Give keystoneauth1.ClientException only 1 argument (message)
Change-Id: I970b07e52ed7f2f4440b47800fcb3b6528dce22d
2020-04-29 17:25:01 +09: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
Zuul 2842092b87 Merge "Support for Keystone password_lock option" 2020-04-14 15:38:04 +00: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
Oleksii Petrenko d6fe0170ee Change horizon test runner to pytest
Changes test invocation from `manage.py test` to `pytest`. Adds addtitional
test requirements like pytest, pytest-django, pytest-html. Adds
`pytest.mark` alongside django's test `tag`. Adds posibility to export test
results into xml and html formats.

Depends-On: https://review.opendev.org/#/c/712315/
Related-Bug: #1866666
Co-Authored-By: Ivan Kolodyazhny <e0ne@e0ne.info>
Change-Id: Idb6e63cd23ca2ba8ca56f36eb8b63069bd211944
2020-04-03 13:47:18 +03:00
Ivan Kolodyazhny 14e779bbac Use unittest.mock instead of third party mock
Now that we no longer support py27, we can use the standard library
unittest.mock module instead of the third party mock lib.

Change-Id: I2de669d8e89b8daeb7ee5405ffab35af6307c40b
2020-03-26 19:45:37 +02: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
Ivan Kolodyazhny d870b40583 Remove six usage from openstack_dashboard package
We don't support Python 2 anymore so we don't need this
compatibility library.

six.reraise usages are left as is until it'll be moved to some
base lib like oslo.utils to not re-implenent this method in
Horizon.

This patch also removes Python2-specific base test case methods
assertItemsEqual and assertNotRegexpMatches in flavor of new
Python 3 analogues.

Change-Id: I26a59176be9e9f213128e4945a58b9459334b626
2020-01-15 12:47:48 +02:00
Ivan Kolodyazhny e976461d85 Remove six usage from horizon package
We don't support Python 2 anymore so we don't need this
compatibility library.

six.reraise usages are left as is until it'll be moved to some
base lib like oslo.utils to not re-implenent this method in
Horizon.

This patch also removes Python2-specific base test case methods
assertItemsEqual and assertNotRegexpMatches in flavor of new
Python 3 analogues.

Change-Id: I0b567382edf4d68674a7b8d0b02333fb57293958
2020-01-15 12:36:11 +02:00
Radomir Dopieralski ef4055e288 Fix use of ngettext in registry getName
The setNames and getNames functions in the resource registry were
calling ngettext() on already translated strings that were marked for
translation with gettext() and not ngetttext(). That lead to some
page titles in some locales being displayed as single characters.

Closes-Bug: #1762089
Change-Id: I0ef365e0c0de6ae27a2e80bcb5257132f8c6ba29
2019-12-20 09:44:48 +00:00
Zuul f592481cc0 Merge "Add support for keystone access rules" 2019-11-25 09:25:56 +00:00
Colleen Murphy 4d1786c687 Add support for keystone access rules
Keystone implemented the ability to apply fine-grained access control
restrictions to application credentials[1]. This patch adds new fields
to the application credential creation form and detail view so that
horizon users can use this feature.

[1] http://specs.openstack.org/openstack/keystone-specs/specs/keystone/train/capabilities-app-creds.html

Depends-on: https://review.opendev.org/677585

Change-Id: I2d71392eb8569ffb8cb15af29eea76e120a158cc
2019-10-30 14:47:05 +09:00
Zuul 8baf384250 Merge "Add the unit test for domains" 2019-10-25 07:46:24 +00:00