events and auth updated
This commit is contained in:
@@ -102,13 +102,13 @@ class AuthenticationSelectEventMethods(MethodToEvent):
|
||||
def authentication_select_company_or_occupant_type(
|
||||
cls,
|
||||
request: Request,
|
||||
data,
|
||||
data: Union[EmployeeSelection, OccupantSelection],
|
||||
token_dict: Union[EmployeeTokenObject, OccupantTokenObject]
|
||||
):
|
||||
from api_objects.auth.token_objects import OccupantToken, CompanyToken
|
||||
from api_objects import OccupantToken, CompanyToken
|
||||
|
||||
token_user = get_object_via_access_key(request=request)
|
||||
if token_user.user_type == 1:
|
||||
if data.company_uu_id not in token_user.companies_uu_id_list:
|
||||
if token_dict.user_type == 1:
|
||||
if data.company_uu_id not in token_dict.companies_uu_id_list:
|
||||
return JSONResponse(
|
||||
content={
|
||||
"completed": False,
|
||||
@@ -143,11 +143,10 @@ class AuthenticationSelectEventMethods(MethodToEvent):
|
||||
).data
|
||||
]
|
||||
employee = Employees.filter_one(
|
||||
Employees.people_id == token_user.person_id,
|
||||
Employees.people_id == token_dict.person_id,
|
||||
Employees.staff_id.in_(staff_ids),
|
||||
*Employees.valid_record_args(Employees),
|
||||
).data
|
||||
|
||||
reachable_event_list_id, reachable_event_list_uu_id = (
|
||||
Event2Employee.get_event_id_by_employee_id(employee_id=employee.id)
|
||||
)
|
||||
@@ -163,7 +162,7 @@ class AuthenticationSelectEventMethods(MethodToEvent):
|
||||
Departments.id == duties.department_id,
|
||||
).data
|
||||
bulk_id = Duty.filter_by_one(
|
||||
duty_code="BULK", **Duty.valid_record_dict
|
||||
system=True, duty_code="BULK"
|
||||
).data
|
||||
bulk_duty_id = Duties.filter_by_one(
|
||||
company_id=selected_company.id,
|
||||
@@ -195,7 +194,7 @@ class AuthenticationSelectEventMethods(MethodToEvent):
|
||||
},
|
||||
status_code=status.HTTP_200_OK,
|
||||
)
|
||||
elif token_user.user_type == 2:
|
||||
elif token_dict.user_type == 2:
|
||||
occupant_type = OccupantTypes.filter_by_one(
|
||||
system=True, uu_id=data.occupant_uu_id
|
||||
).data
|
||||
@@ -232,7 +231,7 @@ class AuthenticationSelectEventMethods(MethodToEvent):
|
||||
).data
|
||||
if selected_occupant_type := BuildLivingSpace.filter_one(
|
||||
BuildLivingSpace.occupant_type == occupant_type.id,
|
||||
BuildLivingSpace.person_id == token_user.person_id,
|
||||
BuildLivingSpace.person_id == token_dict.person_id,
|
||||
BuildLivingSpace.build_parts_id == build_part.id,
|
||||
*BuildLivingSpace.valid_record_args(BuildLivingSpace),
|
||||
).data:
|
||||
|
||||
Reference in New Issue
Block a user