Mercurial > libervia-pubsub
diff sat_pubsub/pgsql_storage.py @ 249:aaf5e34ff765
fixed getItems when there are not authorized_groups + fixed default value for StoreItem
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 08 Jun 2012 18:34:45 +0200 |
parents | 50f6ee966da8 |
children | eb14b8d30cba |
line wrap: on
line diff
--- a/sat_pubsub/pgsql_storage.py Sun Jun 03 15:57:28 2012 +0200 +++ b/sat_pubsub/pgsql_storage.py Fri Jun 08 18:34:45 2012 +0200 @@ -68,9 +68,9 @@ NS_ITEM_CONFIG = "http://jabber.org/protocol/pubsub#item-config" OPT_ACCESS_MODEL = 'pubsub#access_model' OPT_ROSTER_GROUPS_ALLOWED = 'pubsub#roster_groups_allowed' -VAL_DEFAULT = 'default' VAL_OPEN = 'open' VAL_ROSTER = 'roster' +VAL_DEFAULT = VAL_OPEN class Storage: @@ -608,11 +608,13 @@ INNER JOIN items USING (node_id) LEFT JOIN item_groups_authorized USING (item_id) WHERE node=%s AND - (items.access_model='open' or - (items.access_model='roster' and groupname in (%s)) - ) + (items.access_model='open' """ + + ("or (items.access_model='roster' and groupname in %s)" if authorized_groups else '') + + """) ORDER BY date DESC"""] - args = [self.nodeIdentifier, authorized_groups] + args = [self.nodeIdentifier] + if authorized_groups: + args.append(authorized_groups) if maxItems: query.append("LIMIT %s")