feat(permissions): 运营默认拥有微博强制更新权限
This commit is contained in:
@@ -309,7 +309,7 @@ def test_occupied_workbench_account_cannot_be_updated_by_another_user(db, curren
|
||||
assert imported.cookie == original_cookie
|
||||
|
||||
|
||||
def test_super_admin_force_updates_occupied_ck_without_changing_owner(db, current_user):
|
||||
def test_operator_force_updates_occupied_ck_without_changing_owner(db, current_user):
|
||||
imported_out = import_cookies(
|
||||
WeiboCookieImport(text="SCF=a; SUB=owner"),
|
||||
db=db,
|
||||
@@ -324,6 +324,14 @@ def test_super_admin_force_updates_occupied_ck_without_changing_owner(db, curren
|
||||
)
|
||||
db.add(owner)
|
||||
db.commit()
|
||||
operator = User(
|
||||
username="weibo-force-update-operator",
|
||||
password_hash="hash",
|
||||
role="operation",
|
||||
is_active=True,
|
||||
)
|
||||
db.add(operator)
|
||||
db.commit()
|
||||
imported.assigned_to = owner.id
|
||||
db.add(
|
||||
WeiboWorkbenchAccount(
|
||||
@@ -341,7 +349,7 @@ def test_super_admin_force_updates_occupied_ck_without_changing_owner(db, curren
|
||||
force_update=True,
|
||||
),
|
||||
db=db,
|
||||
current=current_user,
|
||||
current=operator,
|
||||
)
|
||||
|
||||
assert result.count == 1
|
||||
@@ -1153,7 +1161,7 @@ def test_weibo_batch_assign_cleans_previous_workbench(db):
|
||||
assert "SCF=a" not in audit.detail
|
||||
|
||||
|
||||
def test_weibo_force_assign_requires_dedicated_permission(db):
|
||||
def test_weibo_force_assign_permissions_for_operator_and_support(db):
|
||||
old_support = User(
|
||||
username="weibo-force-old-support",
|
||||
password_hash="hash",
|
||||
@@ -1183,17 +1191,7 @@ def test_weibo_force_assign_requires_dedicated_permission(db):
|
||||
db.add(account)
|
||||
db.commit()
|
||||
|
||||
assert "weibo:assign:force" not in ROLE_PERMISSIONS["operation"]
|
||||
with pytest.raises(HTTPException) as exc_info:
|
||||
batch_assign_accounts(
|
||||
WeiboBatchAssignRequest(
|
||||
account_ids=[account.id],
|
||||
assigned_to=support.id,
|
||||
),
|
||||
db=db,
|
||||
current=operator,
|
||||
)
|
||||
assert exc_info.value.status_code == 403
|
||||
assert "weibo:assign:force" in ROLE_PERMISSIONS["operation"]
|
||||
|
||||
with pytest.raises(HTTPException) as exc_info:
|
||||
force_assign_accounts(
|
||||
@@ -1203,15 +1201,10 @@ def test_weibo_force_assign_requires_dedicated_permission(db):
|
||||
expected_count=1,
|
||||
),
|
||||
db=db,
|
||||
current=operator,
|
||||
current=support,
|
||||
)
|
||||
assert exc_info.value.status_code == 403
|
||||
|
||||
operator.custom_permissions = [
|
||||
*ROLE_PERMISSIONS["operation"],
|
||||
"weibo:assign:force",
|
||||
]
|
||||
db.commit()
|
||||
result = force_assign_accounts(
|
||||
WeiboForceAssignRequest(
|
||||
account_ids=[account.id],
|
||||
|
||||
@@ -120,6 +120,7 @@ ROLE_PERMISSIONS = {
|
||||
"weibo:view",
|
||||
"weibo:workbench",
|
||||
"weibo:assign",
|
||||
"weibo:assign:force",
|
||||
"weibo:import",
|
||||
"weibo:manage",
|
||||
"weibo:account:ck_export",
|
||||
|
||||
@@ -477,7 +477,7 @@ export default function UsersPage() {
|
||||
<div>
|
||||
<Text type="secondary">
|
||||
打开后可查看“全部账号”页签,并把勾选账号或指定标签的账号强制转给客服。
|
||||
该权限仅超级管理员默认拥有,运营默认关闭。
|
||||
超级管理员和运营默认拥有,客服默认关闭。
|
||||
</Text>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user