2021-04-26 20:07:00 +02:00
|
|
|
#coding:utf-8
|
|
|
|
|
2022-01-26 21:10:46 +01:00
|
|
|
"""
|
|
|
|
ID: issue-6088
|
|
|
|
ISSUE: 6088
|
|
|
|
TITLE: ALTER CURRENT USER fails with "no permission for <...> TABLE PLG$SRP" if current user: 1) has NO admin role and 2) wants to modify his own TAGS list
|
|
|
|
DESCRIPTION:
|
|
|
|
Code of this test must to be changed after ticket will be fixed!
|
|
|
|
See line with 'grant admin role' -- it must me COMMENTED.
|
|
|
|
Also, min_version should be set to 3.0.x rather than 4.0.0
|
|
|
|
|
|
|
|
Currently we check only ability to change TAGS list using 'ALTER CURRENT USER' statement.
|
|
|
|
See also test for CORE-3365, but it checks only 'old' attributes which existed before FB 3.0.
|
|
|
|
JIRA: CORE-5827
|
2022-02-02 15:46:19 +01:00
|
|
|
FBTEST: bugs.core_5827
|
2022-01-26 21:10:46 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-26 21:10:46 +01:00
|
|
|
import pytest
|
|
|
|
from firebird.qa import *
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-26 21:10:46 +01:00
|
|
|
db = db_factory()
|
|
|
|
tmp_user = user_factory('db', name='tmp$c5827', plugin='Srp', do_not_create=True)
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-26 21:10:46 +01:00
|
|
|
test_script = """
|
2021-04-26 20:07:00 +02:00
|
|
|
set bail on;
|
|
|
|
set list on;
|
|
|
|
|
|
|
|
create user tmp$c5827
|
|
|
|
password 'UseSrp'
|
|
|
|
firstname 'Mary'
|
2022-01-26 21:10:46 +01:00
|
|
|
-- NB: no error will be raised if we UNCOMMENT this line; IMO this is bug, see ticket issue;
|
2021-04-26 20:07:00 +02:00
|
|
|
-- TODO: comment must be here, put it later when this ticket issue will be fixed.
|
2021-12-30 19:43:52 +01:00
|
|
|
-- >>> commented 25.05.2021 >>> grant admin role <<< all OK.
|
2021-04-26 20:07:00 +02:00
|
|
|
using plugin Srp
|
|
|
|
tags (
|
|
|
|
key1 = 'val111'
|
|
|
|
,key2 = 'val222'
|
|
|
|
,key3 = 'val333'
|
|
|
|
)
|
|
|
|
;
|
|
|
|
commit;
|
|
|
|
|
|
|
|
connect '$(DSN)' user tmp$c5827 password 'UseSrp';
|
|
|
|
|
|
|
|
--- passed w/o error:
|
|
|
|
alter current user
|
|
|
|
set password 'FooSrp' firstname 'Scott' lastname 'Tiger'
|
|
|
|
using plugin Srp
|
|
|
|
;
|
|
|
|
commit;
|
|
|
|
|
|
|
|
-- DOES raise error if current user has no admin role:
|
|
|
|
alter current user
|
|
|
|
using plugin Srp
|
|
|
|
tags (
|
|
|
|
Foo = 'Bar'
|
|
|
|
,key1 = 'val11'
|
|
|
|
,Rio = '1565'
|
|
|
|
,drop key3
|
|
|
|
,drop key2
|
|
|
|
)
|
2022-01-26 21:10:46 +01:00
|
|
|
;
|
2021-04-26 20:07:00 +02:00
|
|
|
commit;
|
2021-12-22 20:23:11 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-26 21:10:46 +01:00
|
|
|
act_1 = isql_act('db', test_script)
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2021-12-30 19:43:52 +01:00
|
|
|
@pytest.mark.version('>=3.0.4')
|
2022-01-26 21:10:46 +01:00
|
|
|
def test_1(act_1: Action, tmp_user: User):
|
2021-04-26 20:07:00 +02:00
|
|
|
act_1.execute()
|
|
|
|
|