aboutsummaryrefslogtreecommitdiff
path: root/pyaggr3g470r
diff options
context:
space:
mode:
authorFrançois Schmidts <francois.schmidts@gmail.com>2015-07-06 23:09:24 +0200
committerFrançois Schmidts <francois.schmidts@gmail.com>2015-07-06 23:09:24 +0200
commit8bbfd0e080ac5ef1232cca0663f77e1562c1485e (patch)
tree8f12fe10f1c79b6e036c09f44902f83f76940e6f /pyaggr3g470r
parentimportant fix, the retrieved_date was always now, leading to unmatchable arti... (diff)
downloadnewspipe-8bbfd0e080ac5ef1232cca0663f77e1562c1485e.tar.gz
newspipe-8bbfd0e080ac5ef1232cca0663f77e1562c1485e.tar.bz2
newspipe-8bbfd0e080ac5ef1232cca0663f77e1562c1485e.zip
making it possible for super admin to update other's feed
Diffstat (limited to 'pyaggr3g470r')
-rw-r--r--pyaggr3g470r/lib/crawler.py1
-rw-r--r--pyaggr3g470r/views/api/common.py6
-rw-r--r--pyaggr3g470r/views/api/feed.py1
3 files changed, 7 insertions, 1 deletions
diff --git a/pyaggr3g470r/lib/crawler.py b/pyaggr3g470r/lib/crawler.py
index 8d2de15f..de557e45 100644
--- a/pyaggr3g470r/lib/crawler.py
+++ b/pyaggr3g470r/lib/crawler.py
@@ -143,6 +143,7 @@ class PyAggUpdater(AbstractCrawler):
up_feed[key] = fresh_feed[key]
if not self.feed.get('title'):
up_feed['title'] = fresh_feed.get('title', '')
+ up_feed['user_id'] = self.feed['user_id']
logger.info('%r %r - pushing feed attrs %r',
self.feed['id'], self.feed['title'],
diff --git a/pyaggr3g470r/views/api/common.py b/pyaggr3g470r/views/api/common.py
index b8c4dd9d..a7068807 100644
--- a/pyaggr3g470r/views/api/common.py
+++ b/pyaggr3g470r/views/api/common.py
@@ -143,7 +143,11 @@ class PyAggResourceExisting(PyAggAbstractResource):
args = self.reqparse_args(default=False)
new_values = {key: args[key] for key in
set(args).intersection(self.attrs)}
- self.controller.update({'id': obj_id}, new_values)
+ if 'user_id' in new_values and g.user.is_admin():
+ controller = self.wider_controller
+ else:
+ controller = self.controller
+ return controller.update({'id': obj_id}, new_values), 200
def delete(self, obj_id=None):
"""delete a object"""
diff --git a/pyaggr3g470r/views/api/feed.py b/pyaggr3g470r/views/api/feed.py
index f9060263..530f3fef 100644
--- a/pyaggr3g470r/views/api/feed.py
+++ b/pyaggr3g470r/views/api/feed.py
@@ -16,6 +16,7 @@ from pyaggr3g470r.views.api.common import PyAggAbstractResource, \
FEED_ATTRS = {'title': {'type': str},
'description': {'type': str},
'link': {'type': str},
+ 'user_id': {'type': int},
'site_link': {'type': str},
'enabled': {'type': bool, 'default': True},
'etag': {'type': str, 'default': ''},
bgstack15