Skip to Content
avatar image
Former Member

How to query CMS for all folders accessible to the user?

I'm implementing custom UI for the Scheduler and have a landing page presenting all reports and instances available to the user before scheduling. Is there a way to query CMS to find all folders I need to scan for documents accessible to this user?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

6 Answers

  • Best Answer
    Mar 27 at 04:46 PM

    Hi Leonid,

    The simplest solution to this that I can think of is to log on as the Actor and let the CMS handle all of the security with respect to what that user has access to.

    One way to do this is to use Trusted Authentication so that within your application you can log onto the CMS as that user without having to know the user's password. You simply pass in the Username, CMS name and Shared Secret in code and generate a new session for that user.

    From that new user session, generate a logontoken and then use the BIPlatform REST apis to return folders and objects that the user has access to. There is even an API that will return the list of Folders or certain Kind(s) of infoobjects.

    This will greatly reduce the complexity of having to figure out what resources the user has access to. If you really want to go down that road then you can use the Platform ObjectPrincipal APIs to return a user's Effective Rights and Roles on every object in the repository to see if the user has access to it and what level of access (view, refresh, schedule, modify etc). This would be somewhat difficult to do and could possibly put a heavy load on the system.

    Dan

    Add comment
    10|10000 characters needed characters exceeded

  • Mar 27 at 02:57 PM

    Then You have to list the folders for the user. As Dan said above you no need to check your rights for any objects.

    User will not get Foler/Document in query result if user doesn't have permission.

    "SELECT * FROM CI_INFOOBJECTS WHERE SI_KIND='Folder'"

    The result of the query will be the list of folders (user has permission).

    Then you have to loop each folder and get children.

    -

    Bharath

    Add comment
    10|10000 characters needed characters exceeded

  • Mar 26 at 11:24 PM

    If your UI logs on with the user's credentials, then they will only see folders and documents that they have access to.

    So you can have a query that returns different results based on the rights of the user logging in rather than trying to figure out what a user can and cannot see. That will all be done for you.

    Dan

    Add comment
    10|10000 characters needed characters exceeded

  • Mar 27 at 06:23 AM

    Are you trying something similar to "show All " filter in Fiorified BI Launchpad? (https://blogs.sap.com/2017/05/16/fiorified-bi-launchpad-in-boe-4.2/)

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Mar 27 at 01:38 PM

    Our application is employing SAP reports only. The Use Case we are implementing permits scheduling existing reports from the UI unrelated to WebI. The app will be integrated using BI SDK API. The "Reports Dashboard" page we designed presents all reports available to the Actor through the custom UI. Thus, I need to get a complete list of reports by finding all folders accessible to the user and scan them for the documents. I can find all user groups this user is associated with as well as user's personal folders, but not all folders. What I need is to compile complete folder list by accessing user permissions (for the folders). Any ideas ??? Thanks in advance!

    Add comment
    10|10000 characters needed characters exceeded

  • Mar 29 at 05:36 PM

    If you're just going to show a list of reports to the user, then you can just query for "SI_KIND = 'Folder'" However, if you want to show your folders and reports in a "tree" format for the user, you'll need to use recursion to get things in the right places. Start with the "root" folder and get a list of all folders that have the root as their parent - SI_PARENTID = 23. (NOTE: 23 is currently the SI_ID of the root folder in 4.x. In 3.x and earlier, it was 0. So this value may change in the future.) Create a method that will do the following for each folder in the list:

    1. Get the list of all of the folder's child folders.
    2. For each child folder, recursively call this method to "walk down" the folder tree and add the folder to the tree.
    3. Get the list of all of the folder's child documents (SI_KIND <> 'Folder').
    4. Add each document to the tree.

    Below is an example of this code from a program that I wrote to extract information from the CMS database and save it to CSV files:

        private void loadFolder(IInfoObject o) throws Exception{
        	//process this folder
        	_log.info("Load Folder " + o.getTitle());
          FolderInfo fldr = new FolderInfo(o, accessLevels, doAdvSec, doEffectiveRights, treeLevel, _qh, false, _log);
          treeLevel++;
          fldrIds.add(fldr.getId());
          folders.put(o.getID(), fldr);
          //now walk through its subfolders
            String qry = "query://{Select * from CI_INFOOBJECTS where (SI_KIND = 'Folder' or SI_KIND = 'FavoritesFolder') and"+             " SI_PARENTID = %d and SI_NAME <> 'User Folders' order by SI_NAME}";
          _qh.forEachResult(String.format(qry, fldr.getId()), new InfoObjectWorker() {
            public void doWork(IInfoObject o) throws Exception {
              try {
                debugStr = String.format("loadFolder: %d-%s", o.getID(), o.getTitle());
    ******************* This is the recursive part **************************
                if (!folders.containsKey(o.getID())){
                  loadFolder(o);
                    _log.info(String.format("Folder %s loaded", o.getTitle()));
                }
    ******************* end of recursion ************************************
              } catch (SDKException e){
                _log.error("Error loading folder " + o.getTitle() + ". Err=" + e.getDetailMessage());
              }
            }
          });
          treeLevel--;
          if ((doReports || doScheds || doFavorites) && (!noRptFolders.contains(fldr.getTitle().trim()))){
            debugStr = "loadReports: ";
            loadReports(fldr.getId());
            debugStr = "loadFolder: ";
          }
        }
    

    -Dell

    Add comment
    10|10000 characters needed characters exceeded