Commit Graph

33 Commits

Author SHA1 Message Date
Kiran Pawar 858939c190 Add 'default_ad_site' field to security service object
Allows to configure optional field 'default_ad_site' from version 2.76.
Restrict to make sure either server or 'default_at_site' provided, but
not both.

APIImpact
Relates-bug: #1988146

Change-Id: I8e21e9170eace134a51efed84de1ccc58eb7eaaa
2023-02-16 09:28:28 +00:00
Cameron Kolodjski 3fb9b981b0 Remove admin context check, update unit tests
In manila/api/v1/security_service.py, the context.is_admin check is
removed, allowing the subsequent policy check to determine whether the
user can retrieve all security services. Authorization is determined by
the RBAC policy "security_services:get_all_security_services".

In manila/tests/api/v1/test_security_service.py, unit tests for listing
security services based on admin context were replaced with unit tests
for listing security services based on whether the user is authorized or
not.

The unit test test_security_services_list_all_tenants_policy_authorized
asserts that the security services are retrieved when
policy.check_policy returns True.

The unit test
test_security_services_list_all_tenants_policy_not_authorized asserts
that security services are not retrieved when policy.check_policy
raises a NotAuthorized exception.

Closes-Bug: #1916102

Change-Id: I6cce61237f5ee3ce60d8165f6fac5e7e5a63b4dd
Depends-On: https://review.opendev.org/c/openstack/manila-tempest-plugin/+/840727
2022-05-06 17:14:29 -03:00
haixin 03fea855d9 remove usage of six library in api layer
Replace six with Python 3 style code.

Change-Id: I091a45c04686ac8d036107618945fea65fb4a2cf
2021-12-22 10:08:11 +08:00
silvacarloss 14d3e268a0 Add share network with multiple subnets
This patch adds the possibility to create share networks with
multiple subnets in Manila. It also updates the share server api
to receive "share_network_subnet_id" instead of "share_network_id".

Each share network subnet must be associated with only one
availability zone. Each share network must have a single default
share network subnet.

DocImpact
APIImpact
Depends-On: I13bb48e7c03e16c26946ccf9d48e80592391a3d1
Partially-implements: bp share-network-multiple-subnets
Change-Id: Id8814a8b26c9b9dcb1fe71d0d7e9b79e8b8a9210
Closes-Bug: #1588144
Co-Authored-By: lseki <luciomitsuru.seki@fit-tecnologia.org.br>
Co-Authored-By: dviroel <viroel@gmail.com>
2019-09-13 11:27:18 -03:00
zhangqing bb8859f8ac Check all_tenants value in security_service api
Add manila.utils.is_all_tenants to check all_tenants value.

Partial-Bug: #1777551
Co-Authored-By: Yu Weizhong <yuweizhong@cmss.chinamobile.com>
Change-Id: I1c8068cb0d4652f1f0349dc5a8d0a2d3af2318e0
2019-03-19 13:30:58 -07:00
Maurice Schreiber f1b20cd4a9
move securiy service error explanation from comment
Change-Id: If81d6cfd41e8aec63aaa95f3190eec44d7d2fc01
2018-04-11 20:11:40 +02:00
wangqi 896c88d6b7 use http code constant instead of int
Change-Id: I71f3271bd0cfaac61f8e86e8fa373257ce22681e
2018-03-20 09:26:59 +00:00
Jiao Pengju 9f69258cab Fix getting share networks and security services error
It will fail when non-admin tenants try to get share networks
and security services with option '{all_tenants: 1}'.
The reason is that the policy of 'get_all_share_networks' and
'get_all_security_services' are admin api, they do not allow
the non-admin tenants list the share networks and security
services with all_tenants=1. This patch removes the policy check
of non-admin tenants and allows non-admin tenants to request to
list with 'all_tenants=1', however 'all_tenants' in the request
is just ignored.

Change-Id: Ied021b66333f1254cd232bbc38562a4a9b762ad2
Co-Authored-By: Goutham Pacha Ravi <gouthampravi@gmail.com>
Related-Bug: #1721787
2017-12-18 09:17:40 +08:00
yfzhao d510ee8f92 Remove log translations in api 1/5
Log messages are no longer being translated. This removes all use of
the _LE, _LI, and _LW translation markers to simplify logging and to
avoid confusion with new contributions.
This is the 1/5 commit.
Old commit will be abandoned: https://review.openstack.org/#/c/447822/

See:
http://lists.openstack.org/pipermail/openstack-i18n/2016-November/002574.html
http://lists.openstack.org/pipermail/openstack-dev/2017-March/113365.html

Change-Id: I9fd264a443c634465b8548067f86ac14c1a51faa
Partial-Bug: #1674542
2017-03-29 16:55:05 +08:00
zzxwill fb44a0a49e Put all imports from manila.i18n in one line
Put '_', '_LW', '_LI', '_LE' from manila.i18n in one line
to make it beautify. Nova, neutron and many other projects
follow this rule. Like
bc5035343d/nova/virt/disk/mount/nbd.py
ee42af1011/neutron/cmd/ipset_cleanup.py
(added more files)

Change-Id: If7ed442ebe946b32b3234ce37b38ee3a5ccbcb39
2016-09-14 06:07:33 +00:00
ting.wang 2bc625399f Using dict.items() is better than six.iteritems(dict)
Replacing dict.iteritems()/.itervalues() with
six.iteritems(dict)/six.itervalues(dict) was preferred in the past,
but there was a discussion suggesting to avoid six for this[1].
The overhead of creating a temporary list on Python 2 is negligible.

[1]http://lists.openstack.org/pipermail/openstack-dev/2015-June/066391.html
Partially-implements blueprint py3-compatibility

Change-Id: Ia2298733188b3d964d43a547504ede2ebeaba9bd
2016-01-19 22:22:48 +08:00
Valeriy Ponomaryov df6ca7ee5f Fix policy check for API 'security service update'
Manila API for update of security service reads policy for "show" operation
but should do it for "update" operation.

Change-Id: I675f834fcb75f3b7864094601e47c15f60a0864b
Closes-Bug: #1459631
2015-05-28 19:20:35 +03:00
Valeriy Ponomaryov eff9f92f01 Remove unused attr status from models
Models "security_services" and "network_allocations" have attr "status" that is
not used indeed. So, remove it from models and add appropriate migrations.

Closes-Bug: #1459660
Change-Id: Idb3a69916e8052b16c9daebb9bb67b09d1714c46
2015-05-28 19:07:45 +03:00
Igor Malinovskiy a26824818f Remove Limited XML API Support from Manila
Remove the broken XML support presently available in Manila
in order to comply with the general direction among other
OpenStack projects to support JSON only.

Change-Id: Ibb542fa223f7f7d1bf95f3d1f568987ef839cd12
Closes-Bug: #1440782
2015-04-13 15:43:47 +03:00
Valeriy Ponomaryov 63a0504c21 Use oslo_log lib
Module 'log' from oslo-incubator was removed after release of oslo_log library.
So, start using oslo_log, but keep oslo-incubator code yet other common modules
within Manila codebase use it.

Implements bp use-oslo-log-lib

Change-Id: I88224f7c2bd99adb78140dfc3fa73cea437f29cd
2015-02-08 10:42:40 +00:00
Andreas Jaeger 15641fba88 Convert files to use _LE and friends
LOG.warn etc. should be translated separately and thus messages need to
be marked with _LW for LOG.warn, _LI for LOG.info and _LE for LOG.errors
and LOG.exception.

Mark all LOG invocations with proper translation marker.

Use ',' instead of '%' when adding variables to log messages to allow
lazy evaluation.

Add new hacking checks for these.

Change-Id: I31d3ee50f30c63d7d647b1c2b1eae50bf96f0c74
2014-10-31 09:47:59 +01:00
Jenkins 6182313647 Merge "Use oslo.i18n" 2014-10-20 16:18:52 +00:00
Andreas Jaeger 7b659fc4e0 Use oslo.i18n
oslo.i18n provides the i18n function that were provided by
oslo-incubator's gettextutils module

Import _ where needed, oslo.i18n deprecated the builtin method.

Closes-Bug: #1382187
Change-Id: I12aa1c725aa4bb52a9aa46e9c3d2b303839de48b
2014-10-19 19:21:03 +02:00
Julia Varlamova f3289eb610 Add new search options for security service
We can filter security services only by status, name, id and type now.

Add new search options:
    user,
    server,
    dns_ip,
    domain
to _get_security_services in SecurityServiceController to be able to filter
security services by these fields.

Allow filtering security services by share network id.

Add information about share networks to result if 'detailed' mode enabled.

Add unit and tempest tests for filtering security services.

Implements bp improve-security-service-list-filtering

Change-Id: I8b3845c2d705188ec1dc0db33c1e20c8e6c5e559
2014-10-16 11:16:22 +04:00
Julia Varlamova 0f5b706592 Don't allow security service to be updated if used
When we attach security service to share network and create
share server associated with this share network, security service
or share-network should not be updated as well as deleted.

For update should be available only 'name' and 'description' fields.

Don't allow to remove assigned security-service from share-network
when share-servers exist.

Add unit and tempest tests.

Change-Id: Ide82edea355030b281dc709f8545abfd0fcd13fb
Closes-bug: #1357355
2014-09-10 09:42:32 +04:00
Andreas Jaeger 2641eb9b57 Flake8: Fix and enable H405
Fix H405:
H405  multi line docstring summary not separated with an empty line

With this patch, flake8 passes all checks (incl. hacking checks)
except the on-purpose disabled check H904.
Closes-Bug: #1333290

Change-Id: If41259aefc4d6d588da5036f1f25df17b88db04f
2014-08-27 13:39:22 +02:00
Valeriy Ponomaryov 1de1a187d5 Rename 'sid' to 'user' in access rules and sec services
Rename 'sid' (secure identifier) to 'user' for better understanding by user.
Changed parts:
- db entities
- db migration
- share access rule type
- security services
- tempest tests

Change-Id: I527064508f13bd4dc658746970c2606098199c1c
2014-08-15 13:29:40 +00:00
Valeriy Ponomaryov ed197a5f10 py33: use six.iteritems for item iterations (part1)
Partially-implements blueprint py3-compatibility

Change-Id: I0c3356cbaefeb77b6543711d79c370b3f1032683
2014-07-07 12:30:30 -04:00
Christian Berendt 8c5f308aa4 Change logging level AUDIT to INFO
According to the latest revision of the logging guidelines message
of type AUDIT should be moved to INFO.

The latest revision is available at https://review.openstack.org/#/c/91446/
at the moment.

Change-Id: I9f8aaeec0bbd17e58ddb814eb7499dc9d6343ca6
2014-07-07 10:01:22 +02:00
Yulia Portnova b2fd5e6223 Checking security service is not used while deleting
Added db method share_network_get_all_by_security_service that
returns all share networks to which security service is assigned.

Added check to delete method in security service api that
gets list of share networks that security service is assigned at
and raises error if this list is not empty.

Closes-bug: 1304473

Change-Id: Ibb73f77095b035f33376aa1791448de3a1ed939b
2014-04-16 10:15:15 -04:00
vponomaryov 05fa0cc9c8 Added type field to security services index list
Current index has only 'name', 'id' and 'status', and
it will be very useful to have additional key - 'type'.

Change-Id: I647a923ed59aa971e15669d7c9239967c815ea09
2014-04-04 08:12:51 -04:00
Aleks Chirko 826b15692e Fix policy.py
Because inside check_policy() there is hardcoded
'share' target prepended to all policies, any
policy we check will be checked against 'share'
policy. Change check_policy() to use explicit
target and action instead of just action.
Change wrap_check_policy decorator to be a
decorator maker which accepts resource name
as an argument.
Closes-Bug: #1274951
Partial-Bug: #1271943

Change-Id: I85c184035619d78107d56ea94918f608d8d7c282
2014-02-05 15:46:04 +02:00
Jenkins 0b5a4fc6e7 Merge "Fix xml response for create/update security service" 2014-01-23 13:52:36 +00:00
Jenkins 687705fa29 Merge "Add 'password' field to the security service" 2014-01-23 13:52:35 +00:00
Yulia Portnova b6c3281880 Fix xml response for create/update security service
Changed xml template for create/update security service
from SecurityServiceTemplates to SecurityServiceTemplate

Closes bug 1269829

Change-Id: I07f2847b8897cfbc2ee3e1952709925c3c056774
2014-01-23 14:42:21 +02:00
Aleks Chirko 8a229a2c6e Add 'password' field to the security service
Change-Id: I8a6d146645b33d7baff52902b7187b09cdbdf63a
2014-01-23 13:33:36 +02:00
Aleks Chirko c81ad66e7e Add share's networks API
Add server side for share's networks. Implemented controller
will carry user requests to the DB and thus will allow
user to manage share's networks data.

Add share's networks support to the share API.

Partially implements bp: join-tenant-network

Change-Id: Ie4f3945255a049e80083f08a39d7f703a5c75c5e
2014-01-23 13:01:27 +02:00
Yulia Portnova d68efa454c Security service API
Added security service controller to
Manila v1 API.

Partially implements bp: join-tenant-network
Change-Id: Ic11feb44547bf438d925261b587edc828eac31c1
2014-01-13 15:34:48 +00:00