[Developers] Sharing type admin rights

Alec Flett alecf at metaweb.com
Mon Aug 20 16:29:40 UTC 2007



Kirrily Robert wrote:
> So, something I would like to see is the ability to add
> co-administrators to types.
>
>   

This is absolutely possible, just not obvious yet - we haven't really 
exposed the UI for this but the infrastructure is there.

Here's how you can do this in the query editor 
(http://www.freebase.com/view/queryeditor/) - if this seems a little 
scary to you, you can always try it in the sandbox first 
(http://sandbox.freebase.com/view/queryeditor/)

Lets start here: Say I wanted to give people permission to access 
/user/alecf/default_domain. First, I can look at the permissions:

|{
  "query":{
    "id":"/user/alecf/default_domain",
    "permission":null
  }
}
|
That just gives you a permission guid - not amazingly helpful. Let's 
expand it:
|{
  "query":{
    "id":"/user/alecf/default_domain",
    "permission":{
      "*":null,
      "type":"/type/permission"
    }
  }
}
|
In the results you will see something like this:
|....
    "permission":{
      "controls":["Owners of alecf's default types","alecf's 
types","Triathlon Distance","Triathlon 
Race","Distance","Swim","Bike","Run","Races","Comic 
Strip","Author","Comic Strip Author","Comic Strips","Audio 
Program","Hosts","Audio Program Host","Distribution","Audio Program 
Distribution","Programs","Characters","Comic Strip Character","Comic 
Strips","Shows Hosted",null,null,null,null,null,null],
      "creator":"/user/domain_administrator",
...
"permits":["/boot/schema_group","#9202a8c04000641f80000000010c35f4","#9202a8c04000641f80000000010c35ea"],
      "timestamp":"2006-11-30T17:17:40.0018Z",
      "type":"/type/permission"
    }
|
So we see that this permission object *controls* all my types, and that 
there are a few groups, including /boot/schema_group, that are 
*permitted* to modify those types.

But which group really matters? is it /boot/schema_group? #92... 35f4? 
#92....35ea?

Fortunately, the "domain" type has a "owners" property:
|{
  "query":{
    "id":"/user/alecf/default_domain",
    "owners":null,
  }
}

|"owners" is a unique  property, so this will give you only one answer:
|{
  "code":"/api/status/ok",
  "result":{
    "id":"/user/alecf/default_domain",
    "owners":"#9202a8c04000641f80000000010c35f4",
    "type":"/type/domain"
  }
}

|Ah! so now we know that the group #92...35f4 is the owners group. Let's 
add someone:
|{
  "query":{
    "id":"#9202a8c04000641f80000000010c35f4",
    "member":{
      "connect":"insert",
      "id":"/user/myfriend"
    },
    "type":"/type/usergroup"
  }
}
|
we get back:
|{
  "code":"/api/status/ok",
  "result":{
    "id":"#9202a8c04000641f80000000010c35f4",
    "member":{
      "connect":"inserted",
      "id":"/user/metaweb"
    },
    "type":"/type/usergroup"
  }
}|
|
|And now examining the permission from above:
|{
  "query":{
    "id":"/user/alecf/default_domain",
    "permission":{
      "permits":[{
        "id":"#9202a8c04000641f80000000010c35f4",
        "member":[]
      }]
    }
  }
}
|
you can see my friend has been added
|{
  "code":"/api/status/ok",
  "result":{
    "id":"/user/alecf/default_domain",
    "permission":{
      "permits":[{
        "id":"#9202a8c04000641f80000000010c35f4",
        "member":["/user/alecf","/user/myfriend"]
      }]
    }
  }
}|

Hope that helps!

Alec
||
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freebase.com/pipermail/developers/attachments/20070820/a955e1fc/attachment-0001.htm 


More information about the Developers mailing list