Skip to content

Commit ce1a7f3

Browse files
authored
Merge pull request #5048 from StackStorm/open-source-rbac
Update the st2 API validation on RBAC configuration
2 parents cb3c9be + fcac67a commit ce1a7f3

File tree

5 files changed

+19
-17
lines changed

5 files changed

+19
-17
lines changed

CHANGELOG.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ Changed
4242
Contributed by Justin Sostre (@saucetray)
4343
* The built-in ``st2.action.file_writen`` trigger has been renamed to ``st2.action.file_written``
4444
to fix the typo (bug fix) #4992
45+
* Renamed reference to the RBAC backend/plugin from ``enterprise`` to ``default``. Updated st2api
46+
validation to use the new value when checking RBAC configuration. Removed other references to
47+
enterprise for RBAC related contents. (improvement)
4548

4649
Fixed
4750
~~~~~

contrib/runners/inquirer_runner/inquirer_runner/runner.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
roles:
2424
default: []
2525
required: false
26-
description: A list of roles that are permitted to respond to the action (if nothing provided, all are permitted) - REQUIRES ENTERPRISE FEATURES
26+
description: A list of roles that are permitted to respond to the action (if nothing provided, all are permitted) - REQUIRES RBAC FEATURES
2727
type: array
2828
users:
2929
default: []

st2api/st2api/validation.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,15 @@ def validate_rbac_is_correctly_configured():
3636
'You can either enable authentication or disable RBAC.')
3737
raise ValueError(msg)
3838

39-
# 2. Verify enterprise backend is set
40-
if cfg.CONF.rbac.backend != 'enterprise':
41-
msg = ('You have enabled RBAC, but RBAC backend is not set to "enterprise". '
42-
'For RBAC to work, you need to install "bwc-enterprise" package, set '
43-
'"rbac.backend" config option to "enterprise" and restart st2api service.')
39+
# 2. Verify default backend is set
40+
if cfg.CONF.rbac.backend != 'default':
41+
msg = ('You have enabled RBAC, but RBAC backend is not set to "default". '
42+
'For RBAC to work, you need to install "st2-rbac-backend" package, set '
43+
'"rbac.backend" config option to "default" and restart st2api service.')
4444
raise ValueError(msg)
4545

46-
# 2. Verify enterprise bits are available
47-
if 'enterprise' not in available_rbac_backends:
48-
msg = ('"enterprise" RBAC backend is not available. Make sure '
49-
'"bwc-enterprise" and "st2-rbac-backend" system packages are '
50-
'installed.')
46+
# 2. Verify default RBAC backend is available
47+
if 'default' not in available_rbac_backends:
48+
msg = ('"default" RBAC backend is not available. Make sure '
49+
'"st2-rbac-backend" system packages are installed.')
5150
raise ValueError(msg)

st2api/tests/unit/test_validation_utils.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,20 +42,20 @@ def test_validate_rbac_is_correctly_configured_auth_not_enabled(self):
4242
self.assertRaisesRegexp(ValueError, expected_msg,
4343
validate_rbac_is_correctly_configured)
4444

45-
def test_validate_rbac_is_correctly_configured_non_enterprise_backend_set(self):
45+
def test_validate_rbac_is_correctly_configured_non_default_backend_set(self):
4646
cfg.CONF.set_override(group='rbac', name='enable', override=True)
4747
cfg.CONF.set_override(group='rbac', name='backend', override='invalid')
4848
cfg.CONF.set_override(group='auth', name='enable', override=True)
4949

50-
expected_msg = ('You have enabled RBAC, but RBAC backend is not set to "enterprise".')
50+
expected_msg = ('You have enabled RBAC, but RBAC backend is not set to "default".')
5151
self.assertRaisesRegexp(ValueError, expected_msg,
5252
validate_rbac_is_correctly_configured)
5353

54-
def test_validate_rbac_is_correctly_configured_enterprise_backend_not_available(self):
54+
def test_validate_rbac_is_correctly_configured_default_backend_not_available(self):
5555
cfg.CONF.set_override(group='rbac', name='enable', override=True)
56-
cfg.CONF.set_override(group='rbac', name='backend', override='enterprise')
56+
cfg.CONF.set_override(group='rbac', name='backend', override='default')
5757
cfg.CONF.set_override(group='auth', name='enable', override=True)
5858

59-
expected_msg = ('"enterprise" RBAC backend is not available. ')
59+
expected_msg = ('"default" RBAC backend is not available. ')
6060
self.assertRaisesRegexp(ValueError, expected_msg,
6161
validate_rbac_is_correctly_configured)

st2tests/st2tests/fixtures/generic/runners/inquirer.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ runner_parameters:
2424
roles:
2525
default: []
2626
required: false
27-
description: A list of roles that are permitted to respond to the action (if nothing provided, all are permitted) - REQUIRES ENTERPRISE FEATURES
27+
description: A list of roles that are permitted to respond to the action (if nothing provided, all are permitted) - REQUIRES RBAC FEATURES
2828
type: array
2929
users:
3030
default: []

0 commit comments

Comments
 (0)