backend/server/rhnChannel.py | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
New commits:
commit 558dfcde3ee34429fcb1f68ee23c93f3eb8f70ed
Author: Milan Zazrivec <mzazrivec(a)redhat.com>
Date: Fri Mar 30 18:30:36 2012 +0200
805012 - check channel permissions when unsubscribing a channel
diff --git a/backend/server/rhnChannel.py b/backend/server/rhnChannel.py
index a591f51..2c9aad7 100644
--- a/backend/server/rhnChannel.py
+++ b/backend/server/rhnChannel.py
@@ -1787,8 +1787,17 @@ def unsubscribe_channel(server_id, channel, username, password):
server_id, channel))
raise rhnFault(72, "You can not unsubscribe %s from base channel %s." % (
server_id, channel))
- # we're fine
- return unsubscribe_sql(server_id, ret["id"])
+
+ # check specific channel subscription permissions
+ channel_id = ret['id']
+ h = rhnSQL.prepare(_query_can_subscribe)
+ h.execute(cid=channel_id, username=username)
+ ret = h.fetchone_dict()
+
+ if ret and ret['can_subscribe']:
+ return unsubscribe_sql(server_id, channel_id)
+
+ raise rhnFault(71)
# unsubscribe from all channels
def unsubscribe_all_channels(server_id):