← Back to team overview

touch-packages team mailing list archive

[Bug 1465675] Re: API needed to determine if App ID is a scope

 

Below is the source code for retrieving the list of all known scopes.
Note that instantiating the runtime and tearing it down is moderately
expensive, so you probably want to hang onto the runtime handle for the
duration. Apply whatever pattern match is appropriate to the returned
strings.

Given the size of this, I don't think it justifies a separate API call.
For one, as I said earlier, I don't want the concept of application IDs
in the scopes runtime because it doesn't belong there. And a separate
API call wouldn't really make things easier. It takes three lines to
iterate over the list of scopes. That doesn't justify a new API call,
IMO.

#include <unity-scopes.h>

#include <boost/filesystem.hpp>
#include <iostream>

using namespace std;
using namespace unity::scopes;

int main(int /* argc */, char** /* argv */)
{
    try
    {
        // use Runtime.ini from the current directory if present, otherwise let the API pick the default one
        const boost::filesystem::path path("Runtime.ini");
        auto rt = boost::filesystem::exists(path) ? Runtime::create(path.native()) : Runtime::create();
        RegistryProxy r = rt->registry();
        auto mmap = r->list();
        for (auto const& meta : mmap)
        {
            cout << meta.first << endl;
        }
        return 0;
    }
    catch (unity::Exception const& e)
    {
        cerr << e.to_string() << endl;
        return 1;
    }
    return 0;
}

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to unity-scopes-api in
Ubuntu.
https://bugs.launchpad.net/bugs/1465675

Title:
  API needed to determine if App ID is a scope

Status in unity-scopes-api package in Ubuntu:
  New

Bug description:
  
  There are a few cases where we'd like it if a higher level service could determine if a particular AppID is connected to a scope. This mostly deals with requests that relate to trusted session prompts as they need to be overlayed on top of the dash instead of the calling process. Another is so that URL dispatcher can return better errors on the scope:// URL namespace. I don't think that it needs to be complex, roughly something like this:

  bool isScope (const char * appid);

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/unity-scopes-api/+bug/1465675/+subscriptions


References