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

2015-06-23 Thread Michi Henning
** Changed in: unity-scopes-api (Ubuntu)
   Status: New = Invalid

-- 
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:
  Invalid

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

-- 
Mailing list: https://launchpad.net/~touch-packages
Post to : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp


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

2015-06-20 Thread Michi Henning
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

-- 
Mailing list: https://launchpad.net/~touch-packages
Post to : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp


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

2015-06-20 Thread James Henstridge
And if you're after one single scope, you can call get_metadata() rather
than list(), checking for NotFoundException.

-- 
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

-- 
Mailing list: https://launchpad.net/~touch-packages
Post to : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp


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

2015-06-19 Thread James Henstridge
Are you sure you can't click for this information?  Take the Youtube
scope for instance, with a scope ID of
com.ubuntu.scopes.youtube_youtube.  I can get the manifest for the
package with:

click info com.ubuntu.scopes.youtube

Looking at the manifest, the hooks.youtube dict has a scope key, so I
know that this is a scope.  Presumably you can do that with the API too?

-- 
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

-- 
Mailing list: https://launchpad.net/~touch-packages
Post to : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp


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

2015-06-19 Thread Ted Gould
Yes, we could get the information from click. But, then we wouldn't get
things like the scopes that are installed on the image. I think it'd be
better if the scope system provided a function instead of each of the
services implementing it's own opinion of what is a scope.

-- 
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

-- 
Mailing list: https://launchpad.net/~touch-packages
Post to : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp


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

2015-06-18 Thread Ted Gould
I feel like your two points conflict ☺

If looking for a file on the filesystem won't work, then I can't ask
click for the information as if it knew there was a scope there it'd be
writing a file to the filesystem. That's basically what the scope click
hook does. (symbolic link, but whatevs)

Worst case if I had to spin up a full connection that wouldn't be the
end of the world, in these use cases we're talking about long running
processes that could keep the connection open.

-- 
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

-- 
Mailing list: https://launchpad.net/~touch-packages
Post to : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp


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

2015-06-18 Thread Michi Henning
Maybe we are missing each other here. I'm trying to help. I'm just
pointing out that there are some potential issues we should think about.
It may well be that I don't have the complete picture...

When you say if a particular AppID is connected to a scope, I don't
really know what you mean. All the scopes runtime knows about are scope
IDs. That's it. The scopes may be kicking around in all sorts of
directories, depending on configuration. So, there is no  fixed place in
the file system where we can look to answer the question. Instead, we
have to parse a bunch of config files first, and the way to do that get
the information out is to ask the registry. Asking the registry requires
instantiating a client-side runtime.

If you don't mind keeping a runtime around and the cost of initialising
and finalising it, no change to the scopes API is needed at all. The
registry can deliver a list of scope IDs it knows about through already
existing APIs. To the registry, scope IDs are simply strings. It doesn't
understand anything about them, other than that they are unique. So, if
it's possible to answer your question by just looking at a list of known
scope IDs and doing some pattern matching on them, we can do that today,
in a few lines of code. No change to the scopes API necessary. I'm happy
to help with an example client that does this.

So, if all you need is a list of the scope IDs that are known to the
registry, no problem, we can do that right now. If you are asking the
scopes runtime to understand something about the de

-- 
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

-- 
Mailing list: https://launchpad.net/~touch-packages
Post to : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp


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

2015-06-18 Thread Ted Gould
The URL dispatcher case is that it gets a URL that looks like this:

 scope://com.foo_bar

I want to know whether to return an error on that URL because it is a
scope that doesn't exist, or to pass it onto the dash. So it is really
just testing that string to see if it is something that the dash will
understand.

What I want is to be able to ask the Scope system whether it considers
the ID valid. If that involves connecting to service or checking a file
is really an implementation detail. I just want to know if that ID (or
one with the version in it) are considered valid.

-- 
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

-- 
Mailing list: https://launchpad.net/~touch-packages
Post to : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp


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

2015-06-18 Thread Michi Henning
tails of click packaging, I'm concerned because the scopes runtime has
no business knowing about packaging.

-- 
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

-- 
Mailing list: https://launchpad.net/~touch-packages
Post to : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp


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

2015-06-18 Thread Michi Henning
I have two concerns:

- Just looking whether a file is installed somewhere isn't going to
work. That's because the installation locations aren't fixed. For
example, it's possible to run multiple scopes run times side-by-side on
the same machine without having them interfere with each other, by
changing configuration files. Among other things,  tests and the SDK
rely on being able to change configurations. But, to figure out what the
current configuration is requires a fair bit of heavy lifting in terms
of parsing configuration files and the like.

Now, we sure can do this. But, to do it right, we'll have to spin up a
client-side run time. This isn't all that cheap (about 35 ms on a Nexus
4). So, doing this would be worth it only if you could keep that run
time around for multiple queries. Spinning up and shutting down a
separate run time instance just to answer a single question is simply
too expensive.

- I'm reluctant to add knowledge about how things are packaged into the
scopes run time with, really, has no business knowing about such things.
Could you look through the click manifests somehow instead to figure
this out? Seeing that click knows everything about packaging already,
that would seem cleaner?

-- 
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

-- 
Mailing list: https://launchpad.net/~touch-packages
Post to : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp


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

2015-06-16 Thread Ted Gould
On Tue, 2015-06-16 at 23:50 +, Michi Henning wrote:

 We currently don't have any concept of an app ID in the scopes run time,
 except for one place, where we check whether a scope ID looks like
 scope_id_app_id. That's the case for scopes that are bundled with an
 app into the same click.
 
 Is this what you mean?


Well AppID is a concept in Click and the system more than scopes. It is
the name of the package and the hook ID. It is, for instance, what the
name of the apparmor profiles are. But, yes, the same thing.

$(package)_$(hookname)_$(version)

For instance, you can get this value if someone talks to you and you ask
AppArmor what profile the connector is using.


 The easiest way to implement this would be to write a little scopes
 client that gets the list of scopes from the registry and then iterates
 over the scope ID to check whether there is a scope with an ID that
 looks like some-string_app_id.


At some level, I don't really care about the implementation, but in
other situations I've found just checking to see if a file exists in a
cache'd path is fast any easy to implement things like this. For
instance:

if [ -e ~/.local/share/unity-scopes/$(appid) ||
-e /usr/lib/*/unity-scopes/$(appid) ] 

Would probably work well enough.

-- 
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

-- 
Mailing list: https://launchpad.net/~touch-packages
Post to : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp


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

2015-06-16 Thread Michi Henning
We currently don't have any concept of an app ID in the scopes run time,
except for one place, where we check whether a scope ID looks like
scope_id_app_id. That's the case for scopes that are bundled with an
app into the same click.

Is this what you mean?

The easiest way to implement this would be to write a little scopes
client that gets the list of scopes from the registry and then iterates
over the scope ID to check whether there is a scope with an ID that
looks like some-string_app_id.

-- 
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

-- 
Mailing list: https://launchpad.net/~touch-packages
Post to : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp