@@ -16,6 +16,12 @@ function _Embed_BasicEmbed() {
1616 // Read report Id from textbox
1717 var txtEmbedReportId = $ ( '#txtEmbedReportId' ) . val ( ) ;
1818
19+ // Get models. models contains enums that can be used.
20+ var models = window [ 'powerbi-client' ] . models ;
21+
22+ // We give All permissions to demonstrate switching between View and Edit mode and saving report.
23+ var permissions = models . Permissions . All ;
24+
1925 // Embed configuration used to describe the what and how to embed.
2026 // This object is used when calling powerbi.embed.
2127 // This also includes settings and options such as filters.
@@ -25,6 +31,7 @@ function _Embed_BasicEmbed() {
2531 accessToken : txtAccessToken ,
2632 embedUrl : txtEmbedUrl ,
2733 id : txtEmbedReportId ,
34+ permissions : permissions ,
2835 settings : {
2936 filterPaneEnabled : true ,
3037 navContentPaneEnabled : true
@@ -64,7 +71,7 @@ function _Mock_Embed_BasicEmbed(isEdit) {
6471
6572 // Get models. models contains enums that can be used.
6673 var models = window [ 'powerbi-client' ] . models ;
67- var permissions = isEdit ? models . Permissions . Copy : models . Permissions . Read ;
74+ var permissions = models . Permissions . Copy | models . Permissions . Read ;
6875 var viewMode = isEdit ? models . ViewMode . Edit : models . ViewMode . View ;
6976
7077 // Embed configuration used to describe the what and how to embed.
@@ -107,8 +114,8 @@ function _Mock_Embed_BasicEmbed(isEdit) {
107114 report . on ( "error" , function ( event ) {
108115 Log . log ( event . detail ) ;
109116 } ) ;
110-
111- report . off ( "saved" ) ;
117+
118+ report . off ( "saved" ) ;
112119 report . on ( "saved" , function ( event ) {
113120 Log . log ( event . detail ) ;
114121 if ( event . detail . saveAs ) {
@@ -169,12 +176,12 @@ function _Embed_BasicEmbed_EditMode() {
169176 Log . logText ( "Loaded" ) ;
170177 } ) ;
171178
172- report . off ( "error" ) ;
179+ report . off ( "error" ) ;
173180 report . on ( "error" , function ( event ) {
174181 Log . log ( event . detail ) ;
175182 } ) ;
176-
177- report . off ( "saved" ) ;
183+
184+ report . off ( "saved" ) ;
178185 report . on ( "saved" , function ( event ) {
179186 Log . log ( event . detail ) ;
180187 if ( event . detail . saveAs ) {
@@ -730,4 +737,4 @@ function _Events_SaveAsTriggered() {
730737 // You should see an entry in the Log window.
731738
732739 Log . logText ( "Select SaveAs to see events in Log window." ) ;
733- }
740+ }
0 commit comments