Skip to content
This repository has been archived by the owner on Dec 22, 2020. It is now read-only.

Fix #53 Upgrade to be able to set token expiration #54

Merged
merged 2 commits into from
Apr 9, 2017

Conversation

kmorihiro
Copy link
Contributor

Add a feature of setting expiration to cli-create-embed-token.

README.md Outdated

> Examples

To create a Power BI embed token with specific user and one role:

`powerbi create-embed-token -c <collection> -k <key>...key -w 06640...744d8f10 -r 07842...e30 -u "Ali Hamud" --roles "Developer"`
`powerbi create-embed-token -c <collection> -k <key>...key -w 06640...744d8f10 -r 07842...e30 -u "Ali Hamud" --roles "Developer" -e "2020-01-01"`

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please give example of a full time here:
03-02-2018 15:03:54 UTC

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your review and sorry for the delay. I fixed an example to a full-time.

@@ -51,7 +52,8 @@ export default function CliCreateEmbedToken() {
if (!(settings.report || settings.dataset)) {
return cli.error('Either reportId or datasetId must be set');
}
token = powerbi.PowerBIToken.createReportEmbedToken(settings.collection, settings.workspace, settings.report, settings.dataset, settings.scopes, settings.username, settings.roles);
let expiration = settings.expiration ? new Date(settings.expiration) : void 0;
token = powerbi.PowerBIToken.createReportEmbedToken(settings.collection, settings.workspace, settings.report, settings.dataset, settings.scopes, settings.username, settings.roles, expiration);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why void 0?
please sett null

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expiration parameter of createReportEmbedToken should be Date object or no value (undefined, void 0). In fact, expiration is initialized to null by 'createReportEmbedToken' if it's undefined, but it's better to observe function parameter type, IMHO.

@ali-hamud ali-hamud merged commit 7bda3e5 into microsoft:master Apr 9, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants