This repository has been archived by the owner on Dec 22, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update to V1 APIs and Add RLS Support (#15)
* Update CLI to use AppKey * Updating Create-Token to Create-Embed-Token * Bump version and update dependency * Add support for generating RLS embed tokens * Update Readme * Update version dependencies
- Loading branch information
Showing
15 changed files
with
70 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/usr/bin/env node | ||
require('../lib/cli-create-embed-token.js').default(); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import * as powerbi from 'powerbi-api'; | ||
import * as msrest from 'ms-rest'; | ||
import {Cli as cli} from './cli'; | ||
import {Config as config} from './config'; | ||
import * as program from 'commander'; | ||
|
||
export default function CliCreateEmbedToken() { | ||
let pkg = require('../package.json'); | ||
|
||
function list(val) { | ||
return val.split(','); | ||
} | ||
|
||
program.version(pkg.version) | ||
.option('-c, --collection <collection>', 'The Power BI workspace collection') | ||
.option('-k, --accessKey <accessKey>', 'The Power BI workspace collection access key') | ||
.option('-w, --workspace <workspaceId>', 'The Power BI workspace id') | ||
.option('-r, --report <reportId>', 'The Power BI report id') | ||
.option('-u, --username [username]', 'The RLS username') | ||
.option('--roles [roles]', 'The RLS roles', list); | ||
|
||
program.on('--help', function () { | ||
console.log(' Examples:'); | ||
console.log(''); | ||
console.log(' $ powerbi create-embed-token -c <collection>, -w <workspace> -r <reportId> -k <accessKey> -u [username] --roles [roles1,roles2,...]'); | ||
}); | ||
|
||
program.parse(process.argv); | ||
|
||
let settings = config.merge(program); | ||
|
||
if (!(settings.collection && settings.accessKey)) { | ||
program.help(); | ||
} else { | ||
try { | ||
let token: powerbi.PowerBIToken = null; | ||
|
||
if (!settings.accessKey) { | ||
return cli.error('Access key param is required'); | ||
} | ||
|
||
if (!(settings.collection && settings.workspace && settings.report)) { | ||
return cli.error('collection, workspace and report params are required'); | ||
} | ||
token = powerbi.PowerBIToken.createReportEmbedToken(settings.collection, settings.workspace, settings.report, settings.username, settings.roles); | ||
|
||
let jwt = token.generate(settings.accessKey); | ||
cli.success('Embed Token: ', jwt); | ||
|
||
} catch (err) { | ||
cli.error(err); | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters