mirror of https://gitlab.com/bashrc2/epicyon
Rename function
parent
e25c1de005
commit
ea378934f1
|
@ -35,7 +35,7 @@ from posts import create_moderation
|
|||
from auth import store_basic_credentials
|
||||
from auth import remove_password
|
||||
from roles import set_role
|
||||
from roles import set_rolesFromList
|
||||
from roles import actor_roles_from_list
|
||||
from roles import get_actor_roles_list
|
||||
from media import process_meta_data
|
||||
from utils import safe_system_string
|
||||
|
@ -860,7 +860,7 @@ def person_upgrade_actor(base_dir: str, person_json: {},
|
|||
admin_name = get_config_param(base_dir, 'admin')
|
||||
if person_json['id'].endswith('/users/' + admin_name):
|
||||
roles_list = ["admin", "moderator", "editor"]
|
||||
set_rolesFromList(person_json, roles_list)
|
||||
actor_roles_from_list(person_json, roles_list)
|
||||
update_actor = True
|
||||
|
||||
# remove the old roles format
|
||||
|
|
8
roles.py
8
roles.py
|
@ -38,7 +38,7 @@ def _clear_role_status(base_dir: str, role: str) -> None:
|
|||
roles_list = get_actor_roles_list(actor_json)
|
||||
if role in roles_list:
|
||||
roles_list.remove(role)
|
||||
set_rolesFromList(actor_json, roles_list)
|
||||
actor_roles_from_list(actor_json, roles_list)
|
||||
save_json(actor_json, filename)
|
||||
|
||||
|
||||
|
@ -172,7 +172,7 @@ def _set_actor_role(actor_json: {}, role_name: str) -> bool:
|
|||
return True
|
||||
|
||||
|
||||
def set_rolesFromList(actor_json: {}, roles_list: []) -> None:
|
||||
def actor_roles_from_list(actor_json: {}, roles_list: []) -> None:
|
||||
"""Sets roles from a list
|
||||
"""
|
||||
# clear Roles from the occupation list
|
||||
|
@ -245,7 +245,7 @@ def set_role(base_dir: str, nickname: str, domain: str,
|
|||
if role not in roles_list:
|
||||
roles_list.append(role)
|
||||
roles_list.sort()
|
||||
set_rolesFromList(actor_json, roles_list)
|
||||
actor_roles_from_list(actor_json, roles_list)
|
||||
actor_changed = True
|
||||
else:
|
||||
# remove the role
|
||||
|
@ -253,7 +253,7 @@ def set_role(base_dir: str, nickname: str, domain: str,
|
|||
_remove_role(base_dir, nickname, role_files[role])
|
||||
if role in roles_list:
|
||||
roles_list.remove(role)
|
||||
set_rolesFromList(actor_json, roles_list)
|
||||
actor_roles_from_list(actor_json, roles_list)
|
||||
actor_changed = True
|
||||
if actor_changed:
|
||||
save_json(actor_json, actor_filename)
|
||||
|
|
4
tests.py
4
tests.py
|
@ -107,7 +107,7 @@ from skills import set_skill_level
|
|||
from skills import actor_skill_value
|
||||
from skills import set_skills_from_dict
|
||||
from skills import actor_has_skill
|
||||
from roles import set_rolesFromList
|
||||
from roles import actor_roles_from_list
|
||||
from roles import set_role
|
||||
from roles import actor_has_role
|
||||
from auth import constant_time_string_check
|
||||
|
@ -6420,7 +6420,7 @@ def _test_roles() -> None:
|
|||
]
|
||||
}
|
||||
test_roles_list = ["admin", "moderator"]
|
||||
set_rolesFromList(actor_json, test_roles_list)
|
||||
actor_roles_from_list(actor_json, test_roles_list)
|
||||
assert actor_has_role(actor_json, "admin")
|
||||
assert actor_has_role(actor_json, "moderator")
|
||||
assert not actor_has_role(actor_json, "editor")
|
||||
|
|
Loading…
Reference in New Issue