@pnp/graph/permissions¶
Allows you to manipulate the permissions of various entities.
site permissions¶
Allows you to manage application permissions for sites.
list site permissions¶
import { graphfi } from "@pnp/graph";
import "@pnp/graph/sites";
import "@pnp/graph/permissions";
const graph = graphfi(...);
const permissions = await graph.sites.getById("{site id}").permissions();
get a site permission¶
import { graphfi } from "@pnp/graph";
import "@pnp/graph/sites";
import "@pnp/graph/permissions";
const graph = graphfi(...);
const permissions = await graph.sites.getById("{site id}").permissions.getById("{permission id}")();
add a site permission¶
import { graphfi } from "@pnp/graph";
import "@pnp/graph/sites";
import "@pnp/graph/permissions";
const graph = graphfi(...);
const permissions = await graph.sites.getById("{site id}").permissions.add({
roles: ["fullcontrol"],
grantedToIdentities: [{
application: {
id: "89ea5c94-7736-4e25-95ad-3fa95f62b66e",
displayName: "Contoso Time Manager App",
}
}],
});
update a site permission¶
import { graphfi } from "@pnp/graph";
import "@pnp/graph/sites";
import "@pnp/graph/permissions";
const graph = graphfi(...);
const permissions = await graph.sites.getById("{site id}").permissions.getById("{permission id}").update({
roles: ["read"],
});
delete a site permission¶
import { graphfi } from "@pnp/graph";
import "@pnp/graph/sites";
import "@pnp/graph/permissions";
const graph = graphfi(...);
const permissions = await graph.sites.getById("{site id}").permissions.getById("{permission id}").delete();