Skip to content

Commit

Permalink
fix: update fetchHubGroup ro and follow card permission (#1484)
Browse files Browse the repository at this point in the history
  • Loading branch information
vivzhang authored Apr 26, 2024
1 parent 76baf89 commit ef3cabb
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions packages/common/e2e/hub-groups.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe("Hub Groups", () => {
expect(newGroup.membershipAccess).toBe("organization");
const fetchedGroup = await fetchHubGroup(
newGroup.id,
ctxMgr.context.userRequestOptions
ctxMgr.context.hubRequestOptions
);
// verify can* flags
expect(fetchedGroup.canDelete).toBe(true);
Expand All @@ -51,7 +51,7 @@ describe("Hub Groups", () => {
expect(updatedGroup.membershipAccess).toBe("anyone");
await deleteHubGroup(newGroup.id, ctxMgr.context.userRequestOptions);
try {
await fetchHubGroup(newGroup.id, ctxMgr.context.userRequestOptions);
await fetchHubGroup(newGroup.id, ctxMgr.context.hubRequestOptions);
fail("should have thrown error");
} catch (e) {
expect((e as any).message).toBe(
Expand Down
2 changes: 1 addition & 1 deletion packages/common/src/core/fetchHubEntity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export async function fetchHubEntity(
result = await fetchTemplate(identifier, context.requestOptions);
break;
case "group":
result = await fetchHubGroup(identifier, context.userRequestOptions);
result = await fetchHubGroup(identifier, context.hubRequestOptions);
break;
case "survey":
result = await fetchSurvey(identifier, context.hubRequestOptions);
Expand Down
2 changes: 1 addition & 1 deletion packages/common/src/groups/HubGroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export class HubGroup
context: IArcGISContext
): Promise<HubGroup> {
try {
const group = await fetchHubGroup(identifier, context.userRequestOptions);
const group = await fetchHubGroup(identifier, context.hubRequestOptions);
// create an instance of HubGroup from the group
return HubGroup.fromJson(group, context);
} catch (ex) {
Expand Down
2 changes: 1 addition & 1 deletion packages/common/src/groups/HubGroups.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export async function createHubGroup(
*/
export async function fetchHubGroup(
identifier: string,
requestOptions: IUserRequestOptions
requestOptions: IHubRequestOptions
): Promise<IHubGroup> {
const group = await getGroup(identifier, requestOptions);
return convertGroupToHubGroup(group, requestOptions);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { PropertyMapper } from "../../core/_internal/PropertyMapper";
import { IHubGroup } from "../../core/types/IHubGroup";
import { computeProps } from "./computeProps";
import { getPropertyMap } from "./getPropertyMap";
import { IUserRequestOptions } from "@esri/arcgis-rest-auth";
import { IHubRequestOptions } from "../../types";

/**
* Convert an IGroup to a Hub Group
Expand All @@ -13,7 +13,7 @@ import { IUserRequestOptions } from "@esri/arcgis-rest-auth";

export function convertGroupToHubGroup(
group: IGroup,
requestOptions: IUserRequestOptions
requestOptions: IHubRequestOptions
): IHubGroup {
const mapper = new PropertyMapper<Partial<IHubGroup>, IGroup>(
getPropertyMap()
Expand Down
2 changes: 1 addition & 1 deletion packages/common/src/permissions/HubPermissionPolicies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ const SystemPermissionPolicies: IPermissionPolicy[] = [
permission: "hub:card:follow",
environments: ["qaext"],
availability: ["flag"],
licenses: ["hub-premium"],
licenses: ["hub-basic", "hub-premium"],
},
{
// When enabled, the edit & manage links will take the user to umbrella
Expand Down
2 changes: 1 addition & 1 deletion packages/common/test/core/fetchHubEntity.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ describe("fetchHubEntity:", () => {
});
it("fetches group", async () => {
const ctx = {
userRequestOptions: "fakeRequestOptions",
hubRequestOptions: "fakeRequestOptions",
} as unknown as IArcGISContext;
const spy = spyOn(
require("../../src/groups/HubGroups"),
Expand Down

0 comments on commit ef3cabb

Please sign in to comment.