Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: site's followers pane permissions #1186

Merged
merged 3 commits into from
Aug 24, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 39 additions & 39 deletions package-lock.json

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

7 changes: 7 additions & 0 deletions packages/common/src/core/traits/IWithFollowers.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/**
* properties for entities with followers
*/
export interface IWithFollowers {
/** followers group id */
followersGroupId: string;
}
4 changes: 3 additions & 1 deletion packages/common/src/core/types/IHubSite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
IWithSlug,
} from "../traits/index";
import { IHubItemEntity } from "./IHubItemEntity";
import { IWithFollowers } from "../traits/IWithFollowers";

/**
* DRAFT: Under development and more properties will likely be added
Expand All @@ -18,7 +19,8 @@ export interface IHubSite
IWithCatalog,
IWithLayout,
IWithPermissions,
IWithVersioningBehavior {
IWithVersioningBehavior,
IWithFollowers {
/**
* Array of minimal page objects
*/
Expand Down
29 changes: 29 additions & 0 deletions packages/common/src/sites/_internal/SiteBusinessRules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ export const SitePermissions = [
"hub:site:workspace:collaborators",
"hub:site:workspace:content",
"hub:site:workspace:metrics",
"hub:site:workspace:followers",
"hub:site:workspace:followers:member",
"hub:site:workspace:followers:admin",
] as const;

/**
Expand Down Expand Up @@ -107,6 +110,32 @@ export const SitesPermissionPolicies: IPermissionPolicy[] = [
dependencies: ["hub:site:edit"],
environments: ["devext", "qaext"],
},
{
permission: "hub:site:workspace:followers",
dependencies: ["hub:site:edit"],
},
{
permission: "hub:site:workspace:followers:member",
dependencies: ["hub:site:workspace:followers"],
assertions: [
{
property: "context:currentUser",
type: "is-group-member",
value: "entity:followersGroupId",
},
],
},
{
permission: "hub:site:workspace:followers:admin",
dependencies: ["hub:site:workspace:followers"],
assertions: [
{
property: "context:currentUser",
type: "is-group-admin",
value: "entity:followersGroupId",
},
],
},
];

/**
Expand Down
4 changes: 4 additions & 0 deletions packages/common/src/sites/_internal/getPropertyMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ export function getPropertyMap(): IPropertyMap[] {
entityKey: "slug",
storeKey: "item.properties.slug",
});
map.push({
entityKey: "followersGroupId",
storeKey: "item.properties.followersGroupId",
});
map.push({
entityKey: "legacyCapabilities",
storeKey: "data.values.capabilities",
Expand Down
Loading