mirror of
https://github.com/openziti/zrok.git
synced 2024-12-29 18:19:04 +01:00
add 'private_share_id' to store 'frontends' table (#278)
This commit is contained in:
parent
f9dc0f6ba1
commit
73ea6184c5
@ -45,12 +45,12 @@ func (h *accessHandler) Handle(params share.AccessParams, principal *rest_model_
|
||||
}
|
||||
|
||||
shrToken := params.Body.ShrToken
|
||||
sshr, err := str.FindShareWithToken(shrToken, tx)
|
||||
shr, err := str.FindShareWithToken(shrToken, tx)
|
||||
if err != nil {
|
||||
logrus.Errorf("error finding share")
|
||||
return share.NewAccessNotFound()
|
||||
}
|
||||
if sshr == nil {
|
||||
if shr == nil {
|
||||
logrus.Errorf("unable to find share '%v' for user '%v'", shrToken, principal.Email)
|
||||
return share.NewAccessNotFound()
|
||||
}
|
||||
@ -76,7 +76,7 @@ func (h *accessHandler) Handle(params share.AccessParams, principal *rest_model_
|
||||
"zrokFrontendToken": feToken,
|
||||
"zrokShareToken": shrToken,
|
||||
}
|
||||
if err := zrokEdgeSdk.CreateServicePolicyDial(envZId+"-"+sshr.ZId+"-dial", sshr.ZId, []string{envZId}, addlTags, edge); err != nil {
|
||||
if err := zrokEdgeSdk.CreateServicePolicyDial(envZId+"-"+shr.ZId+"-dial", shr.ZId, []string{envZId}, addlTags, edge); err != nil {
|
||||
logrus.Errorf("unable to create dial policy for user '%v': %v", principal.Email, err)
|
||||
return share.NewAccessInternalServerError()
|
||||
}
|
||||
|
@ -0,0 +1,31 @@
|
||||
-- +migrate Up
|
||||
|
||||
alter table frontends rename to frontends_old;
|
||||
alter sequence frontends_id_seq rename to frontends_id_seq_old;
|
||||
|
||||
create table frontends (
|
||||
id serial primary key,
|
||||
environment_id integer references environments(id),
|
||||
private_share_id integer references shares(id),
|
||||
token varchar(32) not null unique,
|
||||
z_id varchar(32) not null,
|
||||
url_template varchar(1024),
|
||||
public_name varchar(64) unique,
|
||||
reserved boolean not null default(false),
|
||||
created_at timestamptz not null default(current_timestamp),
|
||||
updated_at timestamptz not null default(current_timestamp),
|
||||
deleted boolean not null default(false),
|
||||
);
|
||||
|
||||
insert into frontends (id, environment_id, token, z_id, url_template, public_name, reserved, created_at, updated_at, deleted)
|
||||
select id, environment_id, token, z_id, url_template, public_name, reserved, created_at, updated_at, deleted from frontends_old;
|
||||
|
||||
select setval('frontends_id_seq', (select max(id) from frontends));
|
||||
|
||||
drop table frontends_old;
|
||||
|
||||
alter index frontends_pkey1 rename to frontends_pkey;
|
||||
alter index frontends_public_name_key1 to frontends_public_name_key;
|
||||
alter index frontends_token_key1 to frontends_token_key;
|
||||
|
||||
alter table frontends rename constraint frontends_environment_id_fkey1 to frontends_environment_id_fkey;
|
Loading…
Reference in New Issue
Block a user