Skip to content

Commit

Permalink
Fix RBAC for /analytics/alarms API
Browse files Browse the repository at this point in the history
For /analytics/alarms request, uve_type is not passed correctly to
get_resource_list_from_uve_type(). get_resource_list_from_uve_type()
expects user visible name for uve_type, where as alarms_http_get()
passes internal value of uve_type resulting in analytics-api throwing
error for non admin users.

Change-Id: I30959d645483740b2c753c4209442e013f94b9db
Closes-Bug: #1735054
  • Loading branch information
Sundaresan Rajangam committed Dec 21, 2017
1 parent 1107f8a commit a20d05b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions contrail-opserver/opserver.py
Expand Up @@ -1965,15 +1965,16 @@ def alarms_http_get(self):
alarm_list = self._uve_server.get_alarms(filters)
alms = {}
for ak,av in alarm_list.iteritems():
res_list = self.get_resource_list_from_uve_type(ak, False)
alm_type = ak
if ak in _OBJECT_TABLES:
alm_type = _OBJECT_TABLES[ak].log_query_name
res_list = self.get_resource_list_from_uve_type(alm_type, False)
ulist = []
for uk, uv in av.iteritems():
if res_list is None or uk in res_list:
ulist.append({'name':uk, 'value':uv})
alms[alm_type ] = ulist
if ulist:
alms[alm_type] = ulist
if self._uvepartitions_state == ConnectionStatus.UP:
return json.dumps(alms)
else:
Expand Down

0 comments on commit a20d05b

Please sign in to comment.