Compare commits
No commits in common. "d66e4fe375fa6b729bac883d5262d6a4b37e5a80" and "c034e384c7718f14184994cb77cbb48e435e75db" have entirely different histories.
d66e4fe375
...
c034e384c7
@ -102,7 +102,6 @@ def require_executor(
|
|||||||
UserRoleEnum.ADMIN,
|
UserRoleEnum.ADMIN,
|
||||||
UserRoleEnum.EXECUTOR_DFIP,
|
UserRoleEnum.EXECUTOR_DFIP,
|
||||||
UserRoleEnum.EXECUTOR_RF,
|
UserRoleEnum.EXECUTOR_RF,
|
||||||
UserRoleEnum.EXECUTOR_DURRS,
|
|
||||||
]:
|
]:
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
status_code=status.HTTP_403_FORBIDDEN,
|
status_code=status.HTTP_403_FORBIDDEN,
|
||||||
@ -111,14 +110,10 @@ def require_executor(
|
|||||||
return current_user
|
return current_user
|
||||||
|
|
||||||
|
|
||||||
def require_executor_dfip_or_durrs(
|
def require_executor_dfip(
|
||||||
current_user: AppUser = Depends(get_current_active_user_with_set_db),
|
current_user: AppUser = Depends(get_current_active_user_with_set_db),
|
||||||
) -> AppUser:
|
) -> AppUser:
|
||||||
if current_user.role_id not in [
|
if current_user.role_id not in [UserRoleEnum.ADMIN, UserRoleEnum.EXECUTOR_DFIP]:
|
||||||
UserRoleEnum.ADMIN,
|
|
||||||
UserRoleEnum.EXECUTOR_DFIP,
|
|
||||||
UserRoleEnum.EXECUTOR_DURRS,
|
|
||||||
]:
|
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
status_code=status.HTTP_403_FORBIDDEN,
|
status_code=status.HTTP_403_FORBIDDEN,
|
||||||
detail="Недостаточно прав",
|
detail="Недостаточно прав",
|
||||||
|
|||||||
@ -4,7 +4,7 @@ from sqlalchemy.ext.asyncio import AsyncSession
|
|||||||
from src.api.v1.deps import (
|
from src.api.v1.deps import (
|
||||||
get_current_active_user,
|
get_current_active_user,
|
||||||
require_admin,
|
require_admin,
|
||||||
require_executor_dfip_or_durrs,
|
require_executor_dfip,
|
||||||
)
|
)
|
||||||
from src.db.session import get_db
|
from src.db.session import get_db
|
||||||
from src.db.models.app_user import AppUser
|
from src.db.models.app_user import AppUser
|
||||||
@ -65,7 +65,7 @@ async def get_users(
|
|||||||
async def get_many_ssp(
|
async def get_many_ssp(
|
||||||
user_id: int,
|
user_id: int,
|
||||||
db: AsyncSession = Depends(get_db),
|
db: AsyncSession = Depends(get_db),
|
||||||
current_user: AppUser = Depends(require_executor_dfip_or_durrs),
|
current_user: AppUser = Depends(require_executor_dfip),
|
||||||
):
|
):
|
||||||
user_service = UserService(db)
|
user_service = UserService(db)
|
||||||
ssp_list = await user_service.get_many_ssp(user_id, current_user)
|
ssp_list = await user_service.get_many_ssp(user_id, current_user)
|
||||||
|
|||||||
@ -41,7 +41,7 @@ class FormType(Base):
|
|||||||
FormTypeEnum.FORM_1: ["plan", "contract_summary", "allocation", "sequestration", "reserve", "approved", "collegial", "ckk", "contract_detail", "q1", "q2", "q3", "q4", "totals"],
|
FormTypeEnum.FORM_1: ["plan", "contract_summary", "allocation", "sequestration", "reserve", "approved", "collegial", "ckk", "contract_detail", "q1", "q2", "q3", "q4", "totals"],
|
||||||
FormTypeEnum.FORM_2: ["plan", "seq_dfip", "seq_ssp", "approved", "contract", "booking", "q1", "q2", "q3", "q4", "totals", "contract_summary", "allocation", "collegial", "ckk", "fact_q1", "fact_q2", "fact_q3", "fact_q4"],
|
FormTypeEnum.FORM_2: ["plan", "seq_dfip", "seq_ssp", "approved", "contract", "booking", "q1", "q2", "q3", "q4", "totals", "contract_summary", "allocation", "collegial", "ckk", "fact_q1", "fact_q2", "fact_q3", "fact_q4"],
|
||||||
FormTypeEnum.FORM_3: ["q1", "q2", "q3", "q4", "year"],
|
FormTypeEnum.FORM_3: ["q1", "q2", "q3", "q4", "year"],
|
||||||
FormTypeEnum.FORM_4: ["header", "plan", "seq_dfip", "approved", "contract", "booking", "q1", "q2", "q3", "q4", "totals", "contract_summary", "allocation", "reserve", "collegial", "ckk"],
|
FormTypeEnum.FORM_4: ["plan", "seq_dfip", "approved", "contract", "booking", "q1", "q2", "q3", "q4", "totals", "contract_summary", "allocation", "reserve", "collegial", "ckk"],
|
||||||
}
|
}
|
||||||
|
|
||||||
_sheet_list_with_directions = {
|
_sheet_list_with_directions = {
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import enum
|
|||||||
from typing import Any, Dict, Generic, List, Literal, Optional, TypeVar
|
from typing import Any, Dict, Generic, List, Literal, Optional, TypeVar
|
||||||
from sqlalchemy.exc import MissingGreenlet
|
from sqlalchemy.exc import MissingGreenlet
|
||||||
|
|
||||||
FormPhaseRole = Literal["DFIP", "EXECUTOR_RF", "ADMIN", "DURRS"]
|
FormPhaseRole = Literal["DFIP", "EXECUTOR_RF", "ADMIN"]
|
||||||
|
|
||||||
|
|
||||||
from pydantic import BaseModel, ConfigDict, EmailStr, Field, field_validator, model_validator
|
from pydantic import BaseModel, ConfigDict, EmailStr, Field, field_validator, model_validator
|
||||||
|
|||||||
@ -160,7 +160,6 @@ class UserService:
|
|||||||
UserRoleEnum.ADMIN.value,
|
UserRoleEnum.ADMIN.value,
|
||||||
UserRoleEnum.EXECUTOR_DFIP.value,
|
UserRoleEnum.EXECUTOR_DFIP.value,
|
||||||
UserRoleEnum.EXECUTOR_RF.value,
|
UserRoleEnum.EXECUTOR_RF.value,
|
||||||
UserRoleEnum.EXECUTOR_DURRS.value,
|
|
||||||
):
|
):
|
||||||
err = AccessDeniedException()
|
err = AccessDeniedException()
|
||||||
err.description = (
|
err.description = (
|
||||||
@ -191,7 +190,6 @@ class UserService:
|
|||||||
UserRoleEnum.ADMIN.value,
|
UserRoleEnum.ADMIN.value,
|
||||||
UserRoleEnum.EXECUTOR_DFIP.value,
|
UserRoleEnum.EXECUTOR_DFIP.value,
|
||||||
UserRoleEnum.EXECUTOR_RF.value,
|
UserRoleEnum.EXECUTOR_RF.value,
|
||||||
UserRoleEnum.EXECUTOR_DURRS.value,
|
|
||||||
):
|
):
|
||||||
err = AccessDeniedException()
|
err = AccessDeniedException()
|
||||||
err.description = (
|
err.description = (
|
||||||
|
|||||||
@ -104,7 +104,7 @@ export const ModalEditUserSsp = ({ open, onClose, user, deps = [], onEdit }) =>
|
|||||||
</Button>
|
</Button>
|
||||||
</>
|
</>
|
||||||
}>
|
}>
|
||||||
{[ROLES_NAME_ID['executor_dfip'], ROLES_NAME_ID['executor_durrs']].includes(curUser.role_id) && (
|
{curUser.role_id == ROLES_NAME_ID['executor_dfip'] && (
|
||||||
<Box>
|
<Box>
|
||||||
<Typography
|
<Typography
|
||||||
sx={{
|
sx={{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user