diff --git a/api/handlers/reporthandler.py b/api/handlers/reporthandler.py index f10bca6409e781592f199e704a6f61e5eb98544a..fe6fc2ca8b0ab59fbc1e6cc96397ae41355f9182 100644 --- a/api/handlers/reporthandler.py +++ b/api/handlers/reporthandler.py @@ -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} diff --git a/bin/log_csv.py b/bin/log_csv.py index 4ed1b7cedb895f36e05c119645606f450d82f527..8ee287666b52dd443104856eb3949c8aa83d480b 100644 --- a/bin/log_csv.py +++ b/bin/log_csv.py @@ -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())