@esri/hub-discussions
Advanced tools
Comparing version 18.0.0 to 18.1.0
@@ -16,3 +16,3 @@ import { Role, SharingAccess, } from "../../types"; | ||
} | ||
// Once ACL usage is enforce, we will remove authorization by legacy permissions | ||
// Once ACL usage is enforced, we will remove authorization by legacy permissions | ||
return isAuthorizedToPostByLegacyPermissions(user, { | ||
@@ -19,0 +19,0 @@ access, |
import { isOrgAdmin, reduceByGroupMembership } from "../platform"; | ||
function intersectGroups(membershipTypes, strict) { | ||
export { canPostToChannel } from "./can-post-to-channel"; | ||
export { canCreateChannel } from "./can-create-channel"; | ||
function intersectGroups(membershipTypes) { | ||
return (user, channel) => { | ||
@@ -7,3 +9,3 @@ const { groups: sharedGroups } = channel; | ||
const eligibleUserGroups = userGroups.reduce(reduceByGroupMembership(membershipTypes), []); | ||
const method = strict ? "every" : "some"; | ||
const method = "some"; | ||
return sharedGroups[method]((group) => eligibleUserGroups.indexOf(group) > -1); | ||
@@ -57,19 +59,2 @@ }; | ||
/** | ||
* Utility to determine whether User can create Channel of provided IChannel properties | ||
* | ||
* @export | ||
* @param {IChannel} channel | ||
* @param {IUser} user | ||
* @return {*} {boolean} | ||
*/ | ||
export function canCreateChannel(channel, user) { | ||
if (channel.access === "private") { | ||
// ensure user is member of all groups included | ||
return intersectGroups(["owner", "admin", "member"], true)(user, channel); | ||
} | ||
// if org or public channel, must be org admin | ||
return isChannelOrgAdmin(channel, user); | ||
} | ||
export { canPostToChannel } from "./can-post-to-channel"; | ||
/** | ||
* Utility to determine whether a Channel definition (inner) is encapsulated by another Channel's definition (outer) | ||
@@ -76,0 +61,0 @@ * |
@@ -19,3 +19,3 @@ "use strict"; | ||
} | ||
// Once ACL usage is enforce, we will remove authorization by legacy permissions | ||
// Once ACL usage is enforced, we will remove authorization by legacy permissions | ||
return isAuthorizedToPostByLegacyPermissions(user, { | ||
@@ -22,0 +22,0 @@ access, |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isChannelInclusive = exports.canCreateChannel = exports.canModifyChannel = exports.canReadFromChannel = void 0; | ||
exports.isChannelInclusive = exports.canModifyChannel = exports.canReadFromChannel = void 0; | ||
const platform_1 = require("../platform"); | ||
function intersectGroups(membershipTypes, strict) { | ||
var can_post_to_channel_1 = require("./can-post-to-channel"); | ||
Object.defineProperty(exports, "canPostToChannel", { enumerable: true, get: function () { return can_post_to_channel_1.canPostToChannel; } }); | ||
var can_create_channel_1 = require("./can-create-channel"); | ||
Object.defineProperty(exports, "canCreateChannel", { enumerable: true, get: function () { return can_create_channel_1.canCreateChannel; } }); | ||
function intersectGroups(membershipTypes) { | ||
return (user, channel) => { | ||
@@ -10,3 +14,3 @@ const { groups: sharedGroups } = channel; | ||
const eligibleUserGroups = userGroups.reduce(platform_1.reduceByGroupMembership(membershipTypes), []); | ||
const method = strict ? "every" : "some"; | ||
const method = "some"; | ||
return sharedGroups[method]((group) => eligibleUserGroups.indexOf(group) > -1); | ||
@@ -62,21 +66,2 @@ }; | ||
/** | ||
* Utility to determine whether User can create Channel of provided IChannel properties | ||
* | ||
* @export | ||
* @param {IChannel} channel | ||
* @param {IUser} user | ||
* @return {*} {boolean} | ||
*/ | ||
function canCreateChannel(channel, user) { | ||
if (channel.access === "private") { | ||
// ensure user is member of all groups included | ||
return intersectGroups(["owner", "admin", "member"], true)(user, channel); | ||
} | ||
// if org or public channel, must be org admin | ||
return isChannelOrgAdmin(channel, user); | ||
} | ||
exports.canCreateChannel = canCreateChannel; | ||
var can_post_to_channel_1 = require("./can-post-to-channel"); | ||
Object.defineProperty(exports, "canPostToChannel", { enumerable: true, get: function () { return can_post_to_channel_1.canPostToChannel; } }); | ||
/** | ||
* Utility to determine whether a Channel definition (inner) is encapsulated by another Channel's definition (outer) | ||
@@ -83,0 +68,0 @@ * |
import { IUser } from "@esri/arcgis-rest-auth"; | ||
import { IChannel, IPlatformSharing } from "../../types"; | ||
export { canPostToChannel } from "./can-post-to-channel"; | ||
export { canCreateChannel } from "./can-create-channel"; | ||
/** | ||
@@ -22,12 +24,2 @@ * Utility to determine whether User can view posts belonging to Channel | ||
/** | ||
* Utility to determine whether User can create Channel of provided IChannel properties | ||
* | ||
* @export | ||
* @param {IChannel} channel | ||
* @param {IUser} user | ||
* @return {*} {boolean} | ||
*/ | ||
export declare function canCreateChannel(channel: IChannel, user: IUser): boolean; | ||
export { canPostToChannel } from "./can-post-to-channel"; | ||
/** | ||
* Utility to determine whether a Channel definition (inner) is encapsulated by another Channel's definition (outer) | ||
@@ -34,0 +26,0 @@ * |
{ | ||
"name": "@esri/hub-discussions", | ||
"version": "18.0.0", | ||
"version": "18.1.0", | ||
"description": "Module to interact with ArcGIS Hub Discussions API in Node.js and modern browsers.", | ||
@@ -5,0 +5,0 @@ "main": "dist/node/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
163872
92
3506