mirror of
https://github.com/veops/cmdb.git
synced 2025-08-07 00:02:46 +08:00
style: format common setting
This commit is contained in:
@@ -13,13 +13,9 @@ from api.models.common_setting import Department
|
||||
@celery.task(name="common_setting.edit_employee_department_in_acl", queue=COMMON_SETTING_QUEUE)
|
||||
def edit_employee_department_in_acl(e_list, new_d_id, op_uid):
|
||||
"""
|
||||
在 ACL 员工更换部门
|
||||
:param e_list: 员工列表 {acl_rid: 11, department_id: 22}
|
||||
:param new_d_id: 新部门 ID
|
||||
:param op_uid: 操作人 ID
|
||||
|
||||
在老部门中删除员工
|
||||
在新部门中添加员工
|
||||
:param e_list:{acl_rid: 11, department_id: 22}
|
||||
:param new_d_id
|
||||
:param op_uid
|
||||
"""
|
||||
db.session.remove()
|
||||
|
||||
@@ -43,7 +39,6 @@ def edit_employee_department_in_acl(e_list, new_d_id, op_uid):
|
||||
new_department_acl_rid = new_department.acl_rid if new_d_rid_in_acl == new_department.acl_rid else new_d_rid_in_acl
|
||||
|
||||
for employee in e_list:
|
||||
# 根据 部门ID获取部门 acl_rid
|
||||
old_department = Department.get_by(
|
||||
first=True, department_id=employee.get('department_id'), to_dict=False)
|
||||
if not old_department:
|
||||
@@ -61,7 +56,6 @@ def edit_employee_department_in_acl(e_list, new_d_id, op_uid):
|
||||
acl_rid=old_d_rid_in_acl
|
||||
)
|
||||
d_acl_rid = old_department.acl_rid if old_d_rid_in_acl == old_department.acl_rid else old_d_rid_in_acl
|
||||
# 在老部门中删除员工
|
||||
payload = {
|
||||
'app_id': 'acl',
|
||||
'parent_id': d_acl_rid,
|
||||
@@ -71,7 +65,6 @@ def edit_employee_department_in_acl(e_list, new_d_id, op_uid):
|
||||
except Exception as e:
|
||||
result.append(ErrFormat.acl_remove_user_from_role_failed.format(str(e)))
|
||||
|
||||
# 在新部门中添加员工
|
||||
payload = {
|
||||
'app_id': 'acl',
|
||||
'child_ids': [employee_acl_rid],
|
||||
|
Reference in New Issue
Block a user