Until now file rooms were available only to users with direct access to
the file. Now file rooms are available to any user or guest too if the
link is publicly shared (with a link share, for example).
Public shares are identified by a share token instead of a file id, so a
new endpoint, which is a counterpart of FilesController but for share
tokens, was added. The file room, however, is still associated to the
file id like before.
When checking if a participant can join a room if the current user is a
user without direct access to the file or a guest it is not even
possible to know if the file id belongs to a publicly shared file. Due
to this when the room is got for a share token the share token is stored
in the session and then used in following requests when checking whether
the participant can join a room or not.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
This fixes the code so it behaves as stated in the documentation.
In practice currently this should make no difference, as in the Files
app the user joins the room immediately after getting its token;
however, this makes possible to get the token without joining the room,
which will be needed in the future to improve the UX of the Files app.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
When the file is in a shared folder and the file is not explicitly
shared the first share found is not for the file, but for the folder. In
that case the file needs to be searched in the shared folder to get the
proper name for the room.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Before a file was seen as directly accessible by the user if the user
received the file through a user, group, circle or room share. Now files
that are a descendant of a folder that meets those conditions are seen
as directly accessible by the user too.
Due to this now the rooms for files in a shared folder can be accessed
by any user that has access to the folder; it is no longer needed to
explicitly share the file too with them.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>