diff --git a/backend/app/api/api_v1/routers/platform.py b/backend/app/api/api_v1/routers/platform.py index 2ab6b46..53937a6 100644 --- a/backend/app/api/api_v1/routers/platform.py +++ b/backend/app/api/api_v1/routers/platform.py @@ -1,9 +1,9 @@ -from fastapi import Request,Depends, APIRouter, UploadFile,HTTPException,File +from fastapi import Query, Request,Depends, APIRouter, UploadFile,HTTPException,File from app.db import Base,engine from app.db.session import get_db from app.db.crud import * from app.db.schemas import * -from typing import List +from typing import List, Optional from app.core.auth import get_current_active_user,get_current_user from app.core.apiexception import APIException @@ -233,16 +233,17 @@ async def domain_delete( @r.get( "/domain", - response_model=List[Domain], + # response_model=List[Domain], response_model_exclude_none=True, ) async def userdomain_details( request: Request, + userId: Optional[int] = Query(None, alias="userId"), user=Depends(get_current_user), db=Depends(get_db), ): try: - domains = get_domain(db, user.id) + domains = get_domain(db, userId if userId is not None else user.id) return domains except Exception as e: raise APIException('platform:domain',request.url._url,f"Error occurred while get user({user.id}) domain:",e) @@ -285,11 +286,14 @@ async def userdomain_delete( ) async def get_useractivedomain( request: Request, + userId: Optional[int] = Query(None, alias="userId"), user=Depends(get_current_user), db=Depends(get_db), ): try: - domain = get_activedomain(db, user.id) + # domain = get_activedomain(db, user.id) + + domain = get_activedomain(db, userId if userId is not None else user.id) return domain except Exception as e: raise APIException('platform:activedomain',request.url._url,f"Error occurred while get user({user.id}) activedomain:",e) @@ -301,11 +305,12 @@ async def get_useractivedomain( async def update_activeuserdomain( request: Request, domainid:int, + userId: Optional[int] = Query(None, alias="userId"), user=Depends(get_current_user), db=Depends(get_db), ): try: - domain = active_userdomain(db, user.id,domainid) + domain = active_userdomain(db, userId if userId is not None else user.id,domainid) return domain except Exception as e: raise APIException('platform:activedomain',request.url._url,f"Error occurred while update user({user.id}) activedomain:",e) diff --git a/backend/app/db/crud.py b/backend/app/db/crud.py index 2101ad9..70ef451 100644 --- a/backend/app/db/crud.py +++ b/backend/app/db/crud.py @@ -253,8 +253,8 @@ def active_userdomain(db: Session, userid: int,domainid: int): def get_activedomain(db: Session, userid: int): db_domain = db.query(models.Domain).join(models.UserDomain,models.UserDomain.domainid == models.Domain.id ).filter(and_(models.UserDomain.userid == userid,models.UserDomain.active == True)).first() - if not db_domain: - raise HTTPException(status.HTTP_404_NOT_FOUND, detail="Domain not found") + # if not db_domain: + # raise HTTPException(status.HTTP_404_NOT_FOUND, detail="Domain not found") return db_domain def get_domain(db: Session, userid: str): diff --git a/frontend/src/components/EssentialLink.vue b/frontend/src/components/EssentialLink.vue index 59e9f1f..c736344 100644 --- a/frontend/src/components/EssentialLink.vue +++ b/frontend/src/components/EssentialLink.vue @@ -19,6 +19,7 @@ diff --git a/frontend/src/components/UserList.vue b/frontend/src/components/UserList.vue new file mode 100644 index 0000000..64b3b35 --- /dev/null +++ b/frontend/src/components/UserList.vue @@ -0,0 +1,36 @@ + + diff --git a/frontend/src/layouts/MainLayout.vue b/frontend/src/layouts/MainLayout.vue index b5a8019..83d81f5 100644 --- a/frontend/src/layouts/MainLayout.vue +++ b/frontend/src/layouts/MainLayout.vue @@ -2,40 +2,26 @@ - + {{ productName }} V{{ version }} - + - + - + メニュー - + +
+ +
@@ -54,19 +40,19 @@ import { useAuthStore } from 'stores/useAuthStore'; const authStore = useAuthStore(); const essentialLinks: EssentialLinkProps[] = [ -{ + { title: 'ホーム', caption: '設計書から導入する', icon: 'home', link: '/', - target:'_self' + target: '_self' }, { title: 'フローエディター', caption: 'イベントを設定する', icon: 'account_tree', link: '/#/FlowChart', - target:'_self' + target: '_self' }, // { // title: '条件エディター', @@ -76,8 +62,8 @@ const essentialLinks: EssentialLinkProps[] = [ // target:'_self' // }, { - title:'', - isSeparator:true + title: '', + isSeparator: true }, // { // title:'Kintone ポータル', @@ -151,8 +137,33 @@ const essentialLinks: EssentialLinkProps[] = [ // } ]; +const adminLinks: EssentialLinkProps[] = [ + { + title: 'ユーザー管理', + caption: 'ユーザーを管理する', + icon: 'manage_accounts', + link: '/#/user', + target: '_self' + }, + { + title: 'ドメイン管理', + caption: 'kintoneのドメイン設定', + icon: 'domain', + link: '/#/domain', + target: '_self' + }, + { + title: 'ドメイン適用', + caption: 'ユーザー使用可能なドメインの設定', + icon: 'assignment_ind', + link: '/#/userDomain', + target: '_self' + }, +] + const version = process.env.version; const productName = process.env.productName; + onMounted(() => { authStore.toggleLeftMenu(); }); @@ -160,4 +171,8 @@ onMounted(() => { function toggleLeftDrawer() { authStore.toggleLeftMenu(); } +function isAdmin(){ + const permission = authStore.permissions; + return permission === 'admin' +} diff --git a/frontend/src/pages/TenantDomain.vue b/frontend/src/pages/TenantDomain.vue index f440afc..b880503 100644 --- a/frontend/src/pages/TenantDomain.vue +++ b/frontend/src/pages/TenantDomain.vue @@ -1,6 +1,11 @@