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:
|
||||
|
||||
@@ -77,6 +77,12 @@ class SuperUserEventBlock(AddEventFunctionality):
|
||||
{"function_code": "7b58ed84-9a65-4588-994d-30df8366b050"},
|
||||
{"function_code": "5702f0a9-fe8f-4aae-922e-6e04b497ef6a"},
|
||||
{"function_code": "c93a3009-65a0-498d-9191-04484d5cde81"},
|
||||
{"function_code": "6798414c-6c7d-47f0-9d8b-6935a0f51c2e"},
|
||||
{"function_code": "57edc8bf-8f29-4e75-b5e1-9ca0139a3fda"},
|
||||
{"function_code": "b18e8e37-a62b-4a84-9972-ba17121ed393"},
|
||||
{"function_code": "0bb51845-65a2-4340-8872-a3b5aad95468"},
|
||||
{"function_code": "a10571fa-ac1d-4546-9272-cacb911d8004"},
|
||||
{"function_code": "58178738-7489-4f8f-954e-5c8f083c1845"},
|
||||
]
|
||||
|
||||
def __new__(cls, *args, **kwargs):
|
||||
|
||||
Reference in New Issue
Block a user