|
|
|
@ -8,11 +8,12 @@ def manglePluginPerms(apiFunc):
|
|
|
|
|
|
|
|
|
|
When the user which called the apifunc is a plugin this function
|
|
|
|
|
goes through the following steps:
|
|
|
|
|
|
|
|
|
|
- searches the user it should change to
|
|
|
|
|
- checks if this user allowed the plugin to "speak for him"
|
|
|
|
|
- change the request so it looks like the user called himself
|
|
|
|
|
- add an plugin_user entry containing the previous request user
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
This decorator is intended to be used with django piston, so on error
|
|
|
|
|
it will return the appropriate rc.* values.
|
|
|
|
|
"""
|
|
|
|
@ -36,7 +37,7 @@ def manglePluginPerms(apiFunc):
|
|
|
|
|
# FIXME: Could throw exception when we have no plugin for the
|
|
|
|
|
# user - where should we report this?
|
|
|
|
|
plugin = Plugin.objects.get(user=request.user)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 1. find user!
|
|
|
|
|
user = None
|
|
|
|
|
try:
|
|
|
|
@ -64,7 +65,7 @@ def manglePluginPerms(apiFunc):
|
|
|
|
|
|
|
|
|
|
def requirePlugin(apiFunc):
|
|
|
|
|
"""Check if user is a plugin.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Checks if the user is a member of the "Plugin" Group. Returns a rc.FORBIDDEN
|
|
|
|
|
if not.
|
|
|
|
|
"""
|
|
|
|
|