"can_watch_item_answer" added in #1027 didn't respect implicit permissions propagation from ancestor groups (see https://france-ioi.github.io/algorea-devdoc/items/access-rights/#propagation). So, when a user is a descendant of a group having can_watch_generated='answer' on an item, "can_watch_item_answer" was still false, it only respected direct permissions of the user. Here we fix this issue.
"can_watch_item_answer" added in #1027 was displayed even if no 'watch_group_id' was given which doesn't make sense. This PR removes "can_watch_item_answer" from the responses if "watch_group_id" is not given.
Here we rename "can_watch_item_answer" into "can_watch_answer" as there is no need to be so specific.
The service used to return items visible to the user (not to the team) when "as_team_id" was given. This PR eliminates this issue as well.
Also, some useful functions making code more expressive and concise are being introduced here (see the new package "golang").
Also, some useful functions making code more expressive and concise are being introduced here (see the new package "golang").
Fixes #1025 (really)