Skip to content
Snippets Groups Projects
Commit ee16966f authored by Harsha Kethineni's avatar Harsha Kethineni
Browse files

access log query project filter added

parent d014e7cc
No related branches found
No related tags found
No related merge requests found
......@@ -505,6 +505,7 @@ class AccessLogReport(Report):
uid = params.get('user')
limit= params.get('limit', 100)
subject = params.get('subject', None)
project = parmas.get('project', None)
access_types = params.getall('access_type')
if start_date:
......@@ -532,6 +533,7 @@ class AccessLogReport(Report):
self.uid = uid
self.limit = limit
self.subject = subject
self.project = project
self.access_types = access_types
def user_can_generate(self, uid):
......@@ -555,6 +557,8 @@ class AccessLogReport(Report):
query['timestamp']['$lte'] = self.end_date
if self.subject:
query['context.subject.label'] = self.subject
if self.project:
query['context.project.id'] = self.project
if self.access_types:
query['access_type'] = {'$in': self.access_types}
......
......@@ -22,6 +22,7 @@ ARG_TO_PARAMS= {
'e': 'end_date',
'u': 'uid',
'j': 'subject',
'p': 'project',
't': 'access_types'
}
......@@ -71,6 +72,7 @@ if __name__ == '__main__':
parser.add_argument("-u", help="User id", type=str)
parser.add_argument("-l", help="Limit", type=str)
parser.add_argument("-j", help="subJect", type=str)
parser.add_argument("-p", help="project", type=str)
parser.add_argument("-t", help="list of access Types", type=str, nargs='+')
args = vars(parser.parse_args())
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment