12 Replies Latest reply on Jul 15, 2016 6:25 AM by tyishikawa

    Custom Tiles: Possible to Set Config From View?

    tyishikawa

      Is it possible to update the config values of a custom tile from the view? According to Creating Custom View Tiles, you can set config values using the function jive.tiles.close(). Is it possible to do this from the view as well?

        • Re: Custom Tiles: Possible to Set Config From View?

          No. configuration is separated from the view, as configuration is only available to entitled users, while the view itself is usually available to much broader set of people.

            • Re: Custom Tiles: Possible to Set Config From View?
              tyishikawa

              In that case, do you know if updating extended properties (Private Properties and Extended Properties for Jive Tiles ) from the view is possible?

                • Re: Custom Tiles: Possible to Set Config From View?

                  Yes, that is possible.

                    • Re: Custom Tiles: Possible to Set Config From View?
                      hmitchell

                      Yuval

                       

                      If we update extended properties for the Add-on from a Custom View tile, should we expect permission controls to work, or is this supposed to be open to any user?

                       

                      What I mean is that from the scope of a Custom View Tile, we can execute

                       

                      osapi.jive.corev3.systemExtProps.create({"prop":"val"}).execute(function (resp) {

                      });

                      ...and

                      osapi.jive.corev3.systemExtProps.get({}).execute(function (resp) {

                      });

                       

                      These properties seem to be set at the Add-on level.  Should any user be able to update these properties, or only admin?  (It seems that any user can update this).

                        • Re: Custom Tiles: Possible to Set Config From View?

                          Pretty sure that these will be editable by any user.

                          Pulling in Rashed Talukder to validate.

                            • Re: Custom Tiles: Possible to Set Config From View?
                              Ryan Rutan

                              They are updatable by any user with an API OAuth token granted from components of that add-on.  SystemProps are basically just Metadata at the System-level, same as ExtProps are metadata for places, content and people.  

                               

                              Note:  Any user that queries for this information with an access token (session) not granted from this add-on will see nothing and/or a different set of values based on the metadata stored in that add-on.

                               

                              Does that help?

                                • Re: Custom Tiles: Possible to Set Config From View?
                                  hmitchell

                                  Ryan and Yuval, thanks for the quick replies. Ryan, I do not understand how the components of an add-on grant an API OAuth token to a user.  Does this just mean that if a user can see the Custom View Tile (or other add-on component), then they can read and write the systemExtProps associated with the add-on, or is there something in the add-on's setup I am missing?  Maybe I do not understand how "osapi.jive.corev3.systemExtProps" works:  it seems to return a unique set of values different depending on the current add-on scope, but it sounds like these really in a single place at the system level.  Is there any way to configure how these work in a particular scope specifically for read/write access?

                                   

                                  A bit of background, we are trying to set configuration at the add-on level for a jive hosted add-on containing a Custom View Tile.  We were looking for a mechanism that would only allow admins to set the configuration, while any user could read the mechanism.  What we found is that any user (even external) who can see our tile can also execute osapi javascript in the tile scope to update these systemExtProps.  This seems to contrast "createExtProps" and "getExtProps" on a jive object.  (Our concern is a matter of security.) Maybe there is a better suggestion to accomplish this?  Thank you!

                            • Re: Custom Tiles: Possible to Set Config From View?
                              tyishikawa

                              As a follow-up question, can you tell me if it's possible to "pre-set" config values for a custom tile? I want to set default values for certain properties (like the title), but the config always starts out empty. The only way I've been able to set values is with the close() function, but I don't want to close the tile for the user, just save default values.

                                • Re: Custom Tiles: Possible to Set Config From View?
                                  Ryan Rutan

                                  Harrison Mitchell - ExtProps are for metadata and are universally accessible via all users for the add-on.  When using Tiles/Apps, the UUID's associated with each of them bundled into the add-on automatically give them trusted access to ExtProps for the Add-On, my comments earlier where in regards to External Clients that may want to access those same ExtProps, which would need to obtain an OAuth token using the clientID/secret from the add-on to gain visibility.  I would not store any sensitive information in ExtProps for this reason (as you pointed out).  It is recommended that if you have anything of a super sensitive manner that you store that behind the scenes in a service and leverage resources such as this: How to Validate Signed Requests from an App Bundled in an Add-On to make a trusted call to get the information.

                                   

                                  Tyler Ishikawa - I suspect you are asking if there is a way to "not configure" a Tile, and in that case, no.  Tile configuration is used as a way to capture the formal creation of the Tile instance.  This has been a feature requested in the past, but there are some use-cases that aren't fully covered by an implicit save for Tiles, which is why it has not been implemented to date.  The best you can do at this point is probably what you are already doing, which is to code the defaults into your Tile Config and make it a quick Configure and Save experience to minimize user interaction.

                                   

                                  Hope this helps.

                                    • Re: Custom Tiles: Possible to Set Config From View?
                                      tyishikawa

                                      I apologize for my confusing wording. I'm not trying to remove the tile configuration, but rather, set default values for the configuration. Currently, if the admin user makes a tile, but accidentally clicks outside of the tile during the configuration step without clicking "Save", none of the configuration values are saved to config (not even the default values). This prevents me from setting a default title, so when the user views the page, there will be no title set. I would like to prevent this with default values in the config.

                                        • Re: Custom Tiles: Possible to Set Config From View?

                                          In your view JS, check to see if there are values from your config data...if they're undefined, just use a default title. You can't send values from the config to the view from just installation of the tile, and subsequently have the installer press cancel since the .close() method is what passes that object along.

                                            • Re: Custom Tiles: Possible to Set Config From View?
                                              tyishikawa

                                              Currently that's what I'm trying to do. However, Jive tiles automatically set the title (I'm referring to the titles placed at the top of the tile with the Jive styles, seen here with "JIVE TALKS" and "COMMUNITY BLOGS") based on the value in the "title" property stored in the config data. Even if I change the value of config["title"] in the view, it'll ignore this and won't set the title. For any other config data, I can just use the workaround of using default values set in both the view and configuration JavaScript (although, this requires duplication of code, which is not ideal). The title is special in this case, and I haven't been able to find a workaround that works.