Ejemplo n.º 1
0
    def execute(self, request):
        staff_admin = self.auth_user
        StaffServer.judge_staff_role(staff_admin)

        staff = StaffServer.get(request.user_id)

        staff = StaffPermiseServer.hung_permise_bystaff(staff)
        # staff_list = StaffAccountServer.hung_account_forstaffs(staff_list)

        return staff
Ejemplo n.º 2
0
    def execute(self, request):
        """判断是否为管理员"""
        staff_admin = self.auth_user
        StaffServer.judge_staff_role(staff_admin)
        """身份证号是否存在"""
        StaffServer.check_exist(request.user_info['identity'])
        """创建员工"""
        staff = StaffServer.register(**request.user_info)
        """添加权限关系"""
        if 'role_ids' in request.user_info:
            StaffPermiseServer.generate_staff_access(
                request.user_info['role_ids'], "role", staff)

        if 'department_ids' in request.user_info:
            StaffPermiseServer.generate_staff_access(
                request.user_info['department_ids'], "department", staff)