feat: ログイン→メニュ→マスタメンテメニュ→ログアウトの導線を修正
This commit is contained in:
parent
bb5f185a6e
commit
cd3567d7f7
@ -28,14 +28,16 @@ def logout_view(
|
||||
redirect_to = '/login/userlogin'
|
||||
link_text = 'MeDaCA機能メニューへ'
|
||||
# セッションが切れておらず、メンテユーザである、またはメンテログイン画面から遷移した場合、メンテログイン画面に戻す
|
||||
if (session is not None and session.user_flg == '1') or referer.endswith('maintlogin'):
|
||||
if (session is not None and session.user_flg == str(constants.PERMISSION_ENABLED)) \
|
||||
or referer.endswith('maintlogin'):
|
||||
redirect_to = '/login/maintlogin'
|
||||
link_text = 'Login画面に戻る'
|
||||
|
||||
logout = LogoutViewModel()
|
||||
logout.redirect_to = redirect_to
|
||||
logout.reason = constants.LOGOUT_REASON_MESSAGE_MAP.get(reason, '')
|
||||
logout.link_text = link_text
|
||||
logout = LogoutViewModel(
|
||||
redirect_to=redirect_to,
|
||||
reason=constants.LOGOUT_REASON_MESSAGE_MAP.get(reason, ''),
|
||||
link_text=link_text
|
||||
)
|
||||
template_response = templates.TemplateResponse(
|
||||
'logout.html',
|
||||
{
|
||||
|
||||
@ -4,9 +4,12 @@ from typing import Optional
|
||||
from fastapi import APIRouter, Depends, HTTPException, Request
|
||||
from fastapi.responses import HTMLResponse
|
||||
from starlette import status
|
||||
|
||||
from src.depends.services import get_service
|
||||
from src.logging.get_logger import get_logger
|
||||
from src.model.internal.session import UserSession
|
||||
from src.model.request.master_mainte_csvdl import MasterMainteCsvDlModel
|
||||
from src.model.request.master_mainte_csvup import MasterMainteCsvUpModel
|
||||
from src.model.view.inst_emp_csv_download_view_model import \
|
||||
InstEmpCsvDownloadViewModel
|
||||
from src.model.view.inst_emp_csv_upload_view_model import \
|
||||
@ -20,9 +23,6 @@ from src.services.master_mainte_service import MasterMainteService
|
||||
from src.services.session_service import set_session
|
||||
from src.system_var import constants
|
||||
from src.templates import templates
|
||||
from src.model.request.master_mainte_csvup import MasterMainteCsvUpModel
|
||||
from src.model.request.master_mainte_csvdl import MasterMainteCsvDlModel
|
||||
|
||||
|
||||
logger = get_logger('マスターメンテ')
|
||||
|
||||
@ -42,7 +42,7 @@ def menu_view(
|
||||
session: UserSession = request.session
|
||||
|
||||
# マスタメンテメニューへのアクセス権がない場合、ログアウトさせる
|
||||
if session.master_mainte_flg != '1':
|
||||
if session.master_mainte_flg == constants.PERMISSION_DISABLED:
|
||||
raise HTTPException(status_code=status.HTTP_403_FORBIDDEN)
|
||||
|
||||
# バッチ処理中の場合、ログアウトさせる
|
||||
@ -82,7 +82,7 @@ def inst_emp_csv_upload_view(
|
||||
session: UserSession = request.session
|
||||
|
||||
# マスタメンテメニューへのアクセス権がない場合、ログアウトさせる
|
||||
if session.master_mainte_flg != '1':
|
||||
if session.master_mainte_flg == constants.PERMISSION_DISABLED:
|
||||
raise HTTPException(status_code=status.HTTP_403_FORBIDDEN)
|
||||
|
||||
# バッチ処理中の場合、ログアウトさせる
|
||||
@ -124,7 +124,7 @@ async def inst_emp_csv_upload(
|
||||
session: UserSession = request.session
|
||||
|
||||
# マスタメンテメニューへのアクセス権がない場合、ログアウトさせる
|
||||
if session.master_mainte_flg != '1':
|
||||
if session.master_mainte_flg == constants.PERMISSION_DISABLED:
|
||||
raise HTTPException(status_code=status.HTTP_403_FORBIDDEN)
|
||||
|
||||
# バッチ処理中の場合、ログアウトさせる
|
||||
@ -186,7 +186,7 @@ def new_inst_result_view(
|
||||
session: UserSession = request.session
|
||||
|
||||
# マスタメンテメニューへのアクセス権がない場合、ログアウトさせる
|
||||
if session.master_mainte_flg != '1':
|
||||
if session.master_mainte_flg == constants.PERMISSION_DISABLED:
|
||||
raise HTTPException(status_code=status.HTTP_403_FORBIDDEN)
|
||||
|
||||
# バッチ処理中の場合、ログアウトさせる
|
||||
@ -226,7 +226,7 @@ def inst_emp_csv_download_view(
|
||||
session: UserSession = request.session
|
||||
|
||||
# マスタメンテメニューへのアクセス権がない場合、ログアウトさせる
|
||||
if session.master_mainte_flg != '1':
|
||||
if session.master_mainte_flg == constants.PERMISSION_DISABLED:
|
||||
raise HTTPException(status_code=status.HTTP_403_FORBIDDEN)
|
||||
|
||||
# バッチ処理中の場合、ログアウトさせる
|
||||
@ -270,7 +270,7 @@ async def inst_emp_csv_download(
|
||||
session: UserSession = request.session
|
||||
|
||||
# マスタメンテメニューへのアクセス権がない場合、ログアウトさせる
|
||||
if session.master_mainte_flg != '1':
|
||||
if session.master_mainte_flg == constants.PERMISSION_DISABLED:
|
||||
raise HTTPException(status_code=status.HTTP_403_FORBIDDEN)
|
||||
|
||||
# バッチ処理中の場合、ログアウトさせる
|
||||
@ -338,7 +338,7 @@ def table_override_view(
|
||||
session: UserSession = request.session
|
||||
|
||||
# マスタメンテメニューへのアクセス権がない場合、ログアウトさせる
|
||||
if session.master_mainte_flg != '1':
|
||||
if session.master_mainte_flg == constants.PERMISSION_DISABLED:
|
||||
raise HTTPException(status_code=status.HTTP_403_FORBIDDEN)
|
||||
|
||||
# バッチ処理中の場合、ログアウトさせる
|
||||
@ -379,7 +379,7 @@ def table_override_result_view(
|
||||
session: UserSession = request.session
|
||||
|
||||
# マスタメンテメニューへのアクセス権がない場合、ログアウトさせる
|
||||
if session.master_mainte_flg != '1':
|
||||
if session.master_mainte_flg == constants.PERMISSION_DISABLED:
|
||||
raise HTTPException(status_code=status.HTTP_403_FORBIDDEN)
|
||||
|
||||
# バッチ処理中の場合、ログアウトさせる
|
||||
|
||||
@ -7,17 +7,17 @@ from src.model.db.base_db_model import BaseDBModel
|
||||
class UserMasterModel(BaseDBModel):
|
||||
user_id: Optional[str]
|
||||
mail_adr: Optional[str]
|
||||
user_nm: Optional[str]
|
||||
auth_flg1: Optional[str]
|
||||
auth_flg2: Optional[str]
|
||||
auth_flg3: Optional[str]
|
||||
auth_flg4: Optional[str]
|
||||
auth_flg5: Optional[str]
|
||||
auth_flg6: Optional[str]
|
||||
auth_flg7: Optional[str]
|
||||
auth_flg8: Optional[str]
|
||||
auth_flg9: Optional[str]
|
||||
auth_flg10: Optional[str]
|
||||
user_name: Optional[str]
|
||||
auth_flg1: Optional[int]
|
||||
auth_flg2: Optional[int]
|
||||
auth_flg3: Optional[int]
|
||||
auth_flg4: Optional[int]
|
||||
auth_flg5: Optional[int]
|
||||
auth_flg6: Optional[int]
|
||||
auth_flg7: Optional[int]
|
||||
auth_flg8: Optional[int]
|
||||
auth_flg9: Optional[int]
|
||||
auth_flg10: Optional[int]
|
||||
pwd: Optional[str]
|
||||
enabled_flg: Optional[str]
|
||||
creater: Optional[str]
|
||||
|
||||
@ -14,10 +14,10 @@ class UserSession(DynamoDBTableModel):
|
||||
session_key = UnicodeAttribute(hash_key=True)
|
||||
user_id = UnicodeAttribute()
|
||||
id_token = UnicodeAttribute()
|
||||
doc_flg = UnicodeAttribute(null=True)
|
||||
inst_flg = UnicodeAttribute(null=True)
|
||||
bio_flg = UnicodeAttribute(null=True)
|
||||
master_mainte_flg = UnicodeAttribute(null=True)
|
||||
doc_flg = NumberAttribute(null=True)
|
||||
inst_flg = NumberAttribute(null=True)
|
||||
bio_flg = NumberAttribute(null=True)
|
||||
master_mainte_flg = NumberAttribute(null=True)
|
||||
user_flg = UnicodeAttribute(null=True)
|
||||
refresh_token = UnicodeAttribute()
|
||||
csrf_token = UnicodeAttribute()
|
||||
|
||||
@ -2,22 +2,23 @@ from typing import Optional
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
from src.system_var import constants
|
||||
|
||||
|
||||
class UserViewModel(BaseModel):
|
||||
bio_flg: Optional[str] # AUTH_FLG1
|
||||
doc_flg: Optional[str] # AUTH_FLG2
|
||||
inst_flg: Optional[str] # AUTH_FLG3
|
||||
master_mainte_flg: Optional[str] # AUTH_FLG4
|
||||
user_flg: Optional[str] # MNTUSER_FLG
|
||||
bio_flg: Optional[int] # AUTH_FLG1
|
||||
doc_flg: Optional[int] # AUTH_FLG2
|
||||
inst_flg: Optional[int] # AUTH_FLG3
|
||||
master_mainte_flg: Optional[int] # AUTH_FLG4
|
||||
|
||||
def has_ult_doctor_permission(self):
|
||||
return self.doc_flg == '1'
|
||||
return self.doc_flg == constants.PERMISSION_ENABLED
|
||||
|
||||
def has_ult_inst_permission(self):
|
||||
return self.inst_flg == '1'
|
||||
return self.inst_flg == constants.PERMISSION_ENABLED
|
||||
|
||||
def has_bio_permission(self):
|
||||
return self.bio_flg == '1'
|
||||
return self.bio_flg == constants.PERMISSION_ENABLED
|
||||
|
||||
def has_master_maintenance_permission(self):
|
||||
return self.master_mainte_flg == '1'
|
||||
return self.master_mainte_flg == constants.PERMISSION_ENABLED
|
||||
|
||||
@ -1,5 +1,10 @@
|
||||
import os.path as path
|
||||
|
||||
# 各画面の権限:有効時の値
|
||||
PERMISSION_ENABLED = 1
|
||||
# 各画面の権限:無効時の値
|
||||
PERMISSION_DISABLED = 0
|
||||
|
||||
# 日付テーブル.バッチ処理ステータス:未処理
|
||||
BATCH_STATUS_PROCESSING = '1'
|
||||
# 日付テーブル.dump取得状態区分:未処理
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user