UNPKG

@firebolt-js/manage-sdk

Version:
111 lines (91 loc) 2.21 kB
/* * Copyright 2021 Comcast Cable Communications Management, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * SPDX-License-Identifier: Apache-2.0 */ import Transport from '../Transport/index.mjs' // Methods function app(appId) { const transforms = null return Transport.send('UserGrants', 'app', { appId }, transforms) } function capability(capability) { const transforms = null return Transport.send('UserGrants', 'capability', { capability }, transforms) } function clear(role, capability, options) { const transforms = null return Transport.send( 'UserGrants', 'clear', { role, capability, options }, transforms, ) } function deny(role, capability, options) { const transforms = null return Transport.send( 'UserGrants', 'deny', { role, capability, options }, transforms, ) } function device() { const transforms = null return Transport.send('UserGrants', 'device', {}, transforms) } function grant(role, capability, options) { const transforms = null return Transport.send( 'UserGrants', 'grant', { role, capability, options }, transforms, ) } function request(appId, permissions, options) { const transforms = null return Transport.send( 'UserGrants', 'request', { appId, permissions, options }, transforms, ) } export default { /** * Role provides access level for the app for a given capability. */ Role: { USE: 'use', MANAGE: 'manage', PROVIDE: 'provide', }, /** * The state the grant is in */ GrantState: { GRANTED: 'granted', DENIED: 'denied', }, app, capability, clear, deny, device, grant, request, }