Skip to content

Conversation

@nikola-n6c
Copy link

One way to implement #18 – adding a checkbox during link creation that the owner can tick in case they want the link to be editable by other users on the tailnet. Not terribly happy about the name, open to suggestions there.

Off by default. Here's what it looks like:
image

No formal tests right now. serveDetail is not really set up for tests given it uses currentUser().
I'm happy to put some time into making these handlers little easier to test with httptest and test this new field in a followup PR is that's the direction you'd like to take.

Tested manually:
First, create link as user foo:

> curl -XPOST -F short=cool-link -F long=https://tailscale.com -F [email protected] localhost:9999
{"Short":"cool-link","Long":"https://tailscale.com","Created":"2022-12-04T16:42:18Z","LastEdit":"2022-12-04T16:45:10.407439Z","Owner":"[email protected]","GloballyEditable":false}

Now, replace the const dev user in currentUser:

> sed -i '' -e 's/[email protected]/[email protected]/g' golink.go

Try changing the link:

> curl -XPOST -F short=cool-link -F long=https://tailscale.net -F [email protected] localhost:9999
not your link; owned by [email protected]

Swap back to foo, and make the link globally editable:

> curl -XPOST -F short=cool-link -F long=https://tailscale.com -F globally-editable=on localhost:9999
{"Short":"cool-link","Long":"https://tailscale.com","Created":"2022-12-04T16:42:18Z","LastEdit":"2022-12-04T16:48:41.522668Z","Owner":"[email protected]","GloballyEditable":true}

Swap back to foo2, and try editing the link:

> curl -XPOST -F short=cool-link -F long=https://tailscale.net localhost:9999
{"Short":"cool-link","Long":"https://tailscale.net","Created":"2022-12-04T16:42:18Z","LastEdit":"2022-12-04T16:50:06.034046Z","Owner":"[email protected]","GloballyEditable":false}

Also taking the liberty to piggyback a gitignore change so that me and future contributors can git add . without worrying about sqlite files, happy to take that out if you feel it shouldn't be there.

@willnorris
Copy link
Member

Hmm, that's interesting... doing it on a per-link basis. From a feature perspective, I do like that it allows you to be open with some links, but to lock down other "official" links you don't want folks editing. See also my comments on #18.

willnorris added a commit that referenced this pull request Apr 2, 2024
Updates #18
Updates #22
Updates #86
Updates #120

Signed-off-by: Will Norris <[email protected]>
willnorris added a commit that referenced this pull request Apr 2, 2024
Updates #18
Updates #22
Updates #86
Updates #120

Signed-off-by: Will Norris <[email protected]>
willnorris added a commit that referenced this pull request Apr 2, 2024
Updates #18
Updates #22
Updates #86
Updates #120

Signed-off-by: Will Norris <[email protected]>
@willnorris
Copy link
Member

We opted to implement this using the newer grants syntax in the tailnet policy file (with docs just recently added to the project README). For now, we only support giving someone admin access to the whole golink instance, rather than per-link. We could look at doing something more granular in the future, but for now this seems like it will accommodate most use-cases.

@willnorris willnorris closed this Apr 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants