mirror of
https://github.com/openziti/zrok.git
synced 2024-12-22 23:02:52 +01:00
wiring up the private share cli to the permission mode; sqlite tweak (#432)
This commit is contained in:
parent
6ba4460eb7
commit
1882783892
@ -29,6 +29,8 @@ type sharePrivateCommand struct {
|
||||
backendMode string
|
||||
headless bool
|
||||
insecure bool
|
||||
closed bool
|
||||
accessGrants []string
|
||||
cmd *cobra.Command
|
||||
}
|
||||
|
||||
@ -43,6 +45,8 @@ func newSharePrivateCommand() *sharePrivateCommand {
|
||||
cmd.Flags().StringVarP(&command.backendMode, "backend-mode", "b", "proxy", "The backend mode {proxy, web, tcpTunnel, udpTunnel, caddy, drive, socks}")
|
||||
cmd.Flags().BoolVar(&command.headless, "headless", false, "Disable TUI and run headless")
|
||||
cmd.Flags().BoolVar(&command.insecure, "insecure", false, "Enable insecure TLS certificate validation for <target>")
|
||||
cmd.Flags().BoolVar(&command.closed, "closed", false, "Enable closed permission mode (see --access-grant)")
|
||||
cmd.Flags().StringArrayVar(&command.accessGrants, "access-grant", []string{}, "zrok accounts that area allowed to access this share (see --closed)")
|
||||
cmd.Run = command.run
|
||||
return command
|
||||
}
|
||||
@ -131,6 +135,10 @@ func (cmd *sharePrivateCommand) run(_ *cobra.Command, args []string) {
|
||||
BasicAuth: cmd.basicAuth,
|
||||
Target: target,
|
||||
}
|
||||
if cmd.closed {
|
||||
req.PermissionMode = sdk.ClosedPermissionMode
|
||||
req.AccessGrants = cmd.accessGrants
|
||||
}
|
||||
shr, err := sdk.CreateShare(root, req)
|
||||
if err != nil {
|
||||
if !panicInstead {
|
||||
|
@ -3,7 +3,7 @@
|
||||
alter table shares add column permission_mode string not null default('open');
|
||||
|
||||
create table access_grants (
|
||||
id serial primary key,
|
||||
id integer primary key,
|
||||
share_id integer references shares(id),
|
||||
account_id integer references accounts(id),
|
||||
created_at datetime not null default(strftime('%Y-%m-%d %H:%M:%f', 'now')),
|
||||
|
Loading…
Reference in New Issue
Block a user