Skip to content

Commit

Permalink
feat: add metrics to project capability permissions (#1086)
Browse files Browse the repository at this point in the history
* feat: add metrics to project capability permissions

* feat: project metris edit permissions not owner
  • Loading branch information
benstoltz authored Jun 9, 2023
1 parent e52a79f commit f67c836
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 33 deletions.
52 changes: 20 additions & 32 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion packages/common/src/capabilities/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@ const validCapabilities = [
"overview",
"settings",
"teams",
"metrics",
] as const;

/**
* Defines the possible values for Capability
*/
export type Capability = typeof validCapabilities[number];
export type Capability = (typeof validCapabilities)[number];

/**
* Validate a capability. This is used because the libary can be used outside of typescript and we want to be able to return a message is the string passed in is not a valid capability
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export const ProjectDefaultCapabilities: EntityCapabilities = {
overview: true,
details: true,
settings: true,
metrics: true,
};

/**
Expand All @@ -35,6 +36,11 @@ export const ProjectCapabilityPermissions: ICapabilityPermission[] = [
capability: "settings",
permissions: ["hub:project:owner"],
},
{
entity: "project",
capability: "metrics",
permissions: ["hub:project:edit"],
},
];

/**
Expand Down
10 changes: 10 additions & 0 deletions packages/common/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,13 @@ export interface ISearchResponse<T> {
next: (params?: any) => Promise<ISearchResponse<T>>;
}

/**
* BEGIN CONTENT UPLOAD RELATED TYPES
* Please note that the below enum/types are duplicated from the AGO
* content upload modal. They were brought over for forward compability purposes and changes
* to them may impact how our content upload works.
*/

/**
* ENUM which defines File extensions.
*/
Expand Down Expand Up @@ -1215,3 +1222,6 @@ export const addCreateItemTypes: Record<string, IFileType> = {
typeKeywords: ["Insights", "Insights Workbook Package"],
},
};
/**
* END CONTENT UPLOAD TYPES/ENUMS
*/

0 comments on commit f67c836

Please sign in to comment.