focalboard icon indicating copy to clipboard operation
focalboard copied to clipboard

Bug: Error when manually adding row to board_members table using sqlite3

Open SpookOz opened this issue 2 years ago • 2 comments

Steps to reproduce the behavior

Using Docker version of focalboard. Unbeknownst to me, a user I shared my board with was creating their own boards and using them. The user has now left and I need to gain access to the boards. I tried to gain access using:

INSERT INTO board_members (board_id,user_id,scheme_admin,scheme_editor,scheme_commenter,scheme_viewer)
VALUES ('xyz','xyz',0,1,0,0);

Expected behavior

I was hoping to be able to access the board

Error

I can now see the board when searching for it, but cannot access the board. The docker logs show the following error: error getting member for board caller="localpermissions/localpermissions.go:50" boardID=xyz userID=xyz error="sql: Scan error on column index 3, name "roles": converting NULL to string is unsupported".

If I run: .schema board_members the roles column looks empty for all rows, but I assume there is something different about it in the other rows that I didn't manually create. Unfortunately, my sqlite skills are very rudimentary!

Edition and Platform

  • Edition: focalboard docker
  • Version: 7.2.0
  • Browser and OS: Chrome

Additional context (optional)

I would also be curios to know how to make the boards visible under "boards" rather than having to search for them. Also, is it possible to stop users from creating their own boards?

Thanks very much in advance.

SpookOz avatar Sep 09 '22 05:09 SpookOz

Note, I was able to get around this issue by copying a current row:

INSERT INTO board_members (board_id,user_id,roles,scheme_admin,scheme_editor,scheme_commenter,scheme_viewer)
    SELECT board_id,"abc",roles,scheme_admin,scheme_editor,scheme_commenter,scheme_viewer
    FROM board_members
    WHERE ( board_id  = 'xyz' AND user_id = 'efg' );

But I'm still curious as to what I'm missing in the roles column

SpookOz avatar Sep 09 '22 06:09 SpookOz

@SpookOz - Sorry for the delayed response.

But I'm still curious as to what I'm missing in the roles column

You were missing setting Roles = "" rather than Roles = null. The model.BoardMember object and doesn't accept null.

I would also be curios to know how to make the boards visible under "boards" rather than having to search for them.

Not currently, but investigating, see https://github.com/mattermost/focalboard/issues/3781

Also, is it possible to stop users from creating their own boards?

Not currently, v7.4.2 adds Commenters and Viewers. But any user in Personal Server can create a board. Our cloud product has the concept of Guest users, those users are not allowed to create a board.

sbishel avatar Oct 12 '22 23:10 sbishel

I believe this can be closed.

sbishel avatar Feb 01 '23 22:02 sbishel