Browse Source

use inherited property from api when rendering permissions

Marcus Efraimsson 7 năm trước cách đây
mục cha
commit
079346917f

+ 1 - 1
public/app/core/components/Permissions/PermissionsListItem.tsx

@@ -41,7 +41,7 @@ export default observer(({ item, removeItem, permissionChanged, itemIndex, folde
     permissionChanged(itemIndex, permissionOption.value, permissionOption.label);
     permissionChanged(itemIndex, permissionOption.value, permissionOption.label);
   };
   };
 
 
-  const inheritedFromRoot = item.dashboardId === -1 && folderInfo && folderInfo.id === 0;
+  const inheritedFromRoot = item.dashboardId === -1 && !item.inherited;
 
 
   return (
   return (
     <tr className={setClassNameHelper(item.inherited)}>
     <tr className={setClassNameHelper(item.inherited)}>

+ 1 - 0
public/app/stores/PermissionsStore/PermissionsStore.jest.ts

@@ -16,6 +16,7 @@ describe('PermissionsStore', () => {
           permissionName: 'View',
           permissionName: 'View',
           teamId: 1,
           teamId: 1,
           team: 'MyTestTeam',
           team: 'MyTestTeam',
+          inherited: true,
         },
         },
         {
         {
           id: 5,
           id: 5,

+ 0 - 2
public/app/stores/PermissionsStore/PermissionsStore.ts

@@ -224,8 +224,6 @@ const prepareServerResponse = (response, dashboardId: number, isFolder: boolean,
 };
 };
 
 
 const prepareItem = (item, dashboardId: number, isFolder: boolean, isInRoot: boolean) => {
 const prepareItem = (item, dashboardId: number, isFolder: boolean, isInRoot: boolean) => {
-  item.inherited = !isFolder && !isInRoot && dashboardId !== item.dashboardId;
-
   item.sortRank = 0;
   item.sortRank = 0;
   if (item.userId > 0) {
   if (item.userId > 0) {
     item.name = item.userLogin;
     item.name = item.userLogin;