{"action":"created","issue":{"url":"https://api.github.com/repos/collective/collective.nitf/issues/128","labels_url":"https://api.github.com/repos/collective/collective.nitf/issues/128/labels{/name}","comments_url":"https://api.github.com/repos/collective/collective.nitf/issues/128/comments","events_url":"https://api.github.com/repos/collective/collective.nitf/issues/128/events","html_url":"https://github.com/collective/collective.nitf/issues/128","id":82103245,"number":128,"title":"Performance problems with NITFBylineViewlet when having many users (specially when using LDAP)","user":{"login":"idgserpro","id":8203476,"avatar_url":"https://avatars.githubusercontent.com/u/8203476?v=3","gravatar_id":"","url":"https://api.github.com/users/idgserpro","html_url":"https://github.com/idgserpro","followers_url":"https://api.github.com/users/idgserpro/followers","following_url":"https://api.github.com/users/idgserpro/following{/other_user}","gists_url":"https://api.github.com/users/idgserpro/gists{/gist_id}","starred_url":"https://api.github.com/users/idgserpro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/idgserpro/subscriptions","organizations_url":"https://api.github.com/users/idgserpro/orgs","repos_url":"https://api.github.com/users/idgserpro/repos","events_url":"https://api.github.com/users/idgserpro/events{/privacy}","received_events_url":"https://api.github.com/users/idgserpro/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-05-28T20:05:44Z","updated_at":"2015-05-29T13:39:35Z","closed_at":null,"body":"When rendering NITF default view, this code is called:\r\n\r\n```\r\n    def getMemberInfoByName(self, fullname):\r\n        membership = api.portal.get_tool('portal_membership')\r\n        members = membership.searchForMembers(name=fullname)\r\n        if members:\r\n            member = members[0].getUserId()  # we care only about the first\r\n            return membership.getMemberInfo(member)\r\n```\r\n\r\n```searchForMembers``` in MembershipTool calls ```listMembers```, listing all users and iterating through all of them. This causes a huge performance problem when using LDAP.\r\n\r\nI want to know the motivation of this snippet so we can try to give a solution. Is this snippet to guarantee that a name inserted in \"byline\" field has a related userid in acl_users? Why we can't ust accept the string that was inserted in the field, is this from NITF standards?\r\n\r\n```members[0]``` isn't a good idea as well. You can have similar names and it validates just the first one found."},"comment":{"url":"https://api.github.com/repos/collective/collective.nitf/issues/comments/106804639","html_url":"https://github.com/collective/collective.nitf/issues/128#issuecomment-106804639","issue_url":"https://api.github.com/repos/collective/collective.nitf/issues/128","id":106804639,"user":{"login":"hvelarde","id":341393,"avatar_url":"https://avatars.githubusercontent.com/u/341393?v=3","gravatar_id":"","url":"https://api.github.com/users/hvelarde","html_url":"https://github.com/hvelarde","followers_url":"https://api.github.com/users/hvelarde/followers","following_url":"https://api.github.com/users/hvelarde/following{/other_user}","gists_url":"https://api.github.com/users/hvelarde/gists{/gist_id}","starred_url":"https://api.github.com/users/hvelarde/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hvelarde/subscriptions","organizations_url":"https://api.github.com/users/hvelarde/orgs","repos_url":"https://api.github.com/users/hvelarde/repos","events_url":"https://api.github.com/users/hvelarde/events{/privacy}","received_events_url":"https://api.github.com/users/hvelarde/received_events","type":"User","site_admin":false},"created_at":"2015-05-29T13:39:35Z","updated_at":"2015-05-29T13:39:35Z","body":"@idgserpro because the byline of a news article could be different from its creator; the byline field defines the name of the person who wrote the piece; the creator field is set with the id of the person who upload it into the CMS.\r\n\r\nif there is a user matching the name in the byline, then we assume that person is the same and we show the link to her personal page as usually; if not, we just show the name without link.\r\n\r\nplease accept your membership in the Collective to be able to merge the pull request."}}