Skip to content

Commit

Permalink
Merge pull request #1367 from hinashi/fixed/category_aclpage
Browse files Browse the repository at this point in the history
Fixed edit category acl setting
  • Loading branch information
userlocalhost authored Feb 13, 2025
2 parents b2f4cfb + 3d519ed commit dc55668
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
7 changes: 7 additions & 0 deletions acl/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from django.dispatch import receiver

from airone.lib.acl import ACLType
from category.models import Category
from entity.models import Entity, EntityAttr
from entry.models import Attribute, Entry
from role.models import HistoricalPermission
Expand All @@ -23,6 +24,12 @@ def aclbase_create_permission(sender, instance, created, **kwargs):
create_permission(instance)


@receiver(post_save, sender=Category)
def category_create_permission(sender, instance, created, **kwargs):
if created:
create_permission(instance)


@receiver(post_save, sender=Entity)
def entity_create_permission(sender, instance, created, **kwargs):
if created:
Expand Down
24 changes: 22 additions & 2 deletions frontend/src/pages/ACLEditPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ import {
EntryRetrieve,
} from "@dmm-com/airone-apiclient-typescript-fetch";
import { zodResolver } from "@hookform/resolvers/zod";
import { Box, Container } from "@mui/material";
import { Box, Container, Typography } from "@mui/material";
import { useSnackbar } from "notistack";
import React, { FC, useCallback, useEffect, useState } from "react";
import { FieldErrors, useForm } from "react-hook-form";
import { useNavigate } from "react-router";
import { Link, useNavigate } from "react-router";

import { useAsyncWithThrow } from "../hooks/useAsyncWithThrow";

import { AironeBreadcrumbs } from "components";
import { ACLForm } from "components/acl/ACLForm";
import { Schema, schema } from "components/acl/aclForm/ACLFormSchema";
import { Loading } from "components/common/Loading";
Expand All @@ -26,6 +27,8 @@ import {
editEntityPath,
entityEntriesPath,
entryDetailsPath,
listCategoryPath,
topPath,
} from "routes/Routes";

export const ACLEditPage: FC = () => {
Expand Down Expand Up @@ -58,6 +61,9 @@ export const ACLEditPage: FC = () => {

const historyReplace = () => {
switch (acl.value?.objtype) {
case ACLObjtypeEnum.Category:
navigate(listCategoryPath(), { replace: true });
break;
case ACLObjtypeEnum.Entity:
if (entity?.id) {
navigate(entityEntriesPath(entity?.id), { replace: true });
Expand Down Expand Up @@ -121,6 +127,20 @@ export const ACLEditPage: FC = () => {
roles: acl.value.roles,
});
switch (acl.value.objtype) {
case ACLObjtypeEnum.Category:
setBreadcrumbs(
<AironeBreadcrumbs>
<Typography component={Link} to={topPath()}>
Top
</Typography>
<Typography component={Link} to={listCategoryPath()}>
カテゴリ一覧
</Typography>
<Typography color="textPrimary">{acl.value.name}</Typography>
<Typography color="textPrimary">ACL設定</Typography>
</AironeBreadcrumbs>
);
break;
case ACLObjtypeEnum.Entity:
aironeApiClient.getEntity(objectId).then((resp) => {
setEntity(resp);
Expand Down

0 comments on commit dc55668

Please sign in to comment.