Commit 4e8509cb authored by Georges Racinet's avatar Georges Racinet 🦑
Browse files

Group.api_retrieve(): owner_name optional argument

Otherwise, all the API calls (including the initial GET) are
done with `root`, and can't work in production server mode.

--HG--
branch : stable
parent dfdf8eae784d
......@@ -45,10 +45,17 @@ class Group:
return self.id == other.id
@classmethod
def api_retrieve(cls, heptapod, group_id):
def api_retrieve(cls, heptapod, group_id, owner_name=None):
"""Return a checked Group object for the given id.
:owner_name: if specified, registered as :attr:`owner_name` on the
returned object, and used for all API calls, including the check
performed by this method.
"""
grp = Group(heptapod=heptapod,
id=group_id,
full_path=None,
owner_name=owner_name,
path=None)
resp = grp.api_get()
assert resp.status_code == 200
......@@ -60,7 +67,7 @@ class Group:
def private_token(self):
"""Return a token strong enough for all operations.
Namely, using a token for an Owner, if there's a known one or
Namely, using a token for an owner, if there's a known one or
an Administrator token
"""
user_name = self.owner_name if self.owner_name is not None else 'root'
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment