Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invite manager "api" for use with NC/OC-10 #3967

Closed

Conversation

michielbdejong
Copy link
Contributor

With this invite manager, OCM invites (both pending and accepted) will be stored in your EFSS instead of inside the revad server in a /var/tmp/reva/ocm-invites.json file which is the current standard behaviour for NC/OC-10 based ScienceMesh sites.

mrvahedi68 and others added 9 commits May 5, 2023 11:23
Signed-off-by: MohammadReza vahedi <[email protected]>
Signed-off-by: MohammadReza vahedi <[email protected]>
Signed-off-by: MohammadReza vahedi <[email protected]>
Signed-off-by: MohammadReza vahedi <[email protected]>
Signed-off-by: MohammadReza vahedi <[email protected]>
Signed-off-by: MohammadReza vahedi <[email protected]>
Signed-off-by: MohammadReza vahedi <[email protected]>
return it, nil
}

func (c *Client) ListTokens(ctx context.Context, initiator *userpb.UserId) ([]*invitepb.InviteToken, error) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported method Client.ListTokens should have comment or be unexported

}

func (c *Client) doGetAllRemoteUsers(initiator string, search string) ([]*apiOCMUser, error) {
requestUrl := c.Config.BaseURL + "/api/v1/find_remote_user/" + initiator + "?search=" + search
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

var requestUrl should be requestURL

}

func (c *Client) doGetRemoteUser(initiator string, opaque_user_id string, idp string) (*apiOCMUser, error) {
requestUrl := c.Config.BaseURL + "/api/v1/get_remote_user/" + initiator + "?userId=" + opaque_user_id + "&idp=" + idp
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

var requestUrl should be requestURL

return true, nil
}

func (c *Client) doGetRemoteUser(initiator string, opaque_user_id string, idp string) (*apiOCMUser, error) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use underscores in Go names; method parameter opaque_user_id should be opaqueUserID

if err != nil {
return false, err
}
requestUrl := c.Config.BaseURL + "/api/v1/add_remote_user/" + initiator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

var requestUrl should be requestURL

return result, nil
}

func (c *Client) doPostRemoteUser(initiator string, opaque_user_id string, idp string, email string, display_name string) (bool, error) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use underscores in Go names; method parameter display_name should be displayName
don't use underscores in Go names; method parameter opaque_user_id should be opaqueUserID

}

func (c *Client) doGetAllTokens(initiator string) ([]*apiToken, error) {
requestUrl := c.Config.BaseURL + "/api/v1/tokens_list/" + initiator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

var requestUrl should be requestURL

}

func (c *Client) doGetToken(token string) (*apiToken, error) {
requestUrl := c.Config.BaseURL + "/api/v1/get_token" + "?token=" + token
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

var requestUrl should be requestURL

return false, err
}

requestUrl := c.Config.BaseURL + "/api/v1/add_token/" + initiator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

var requestUrl should be requestURL


type config struct {
BaseURL string `mapstructure:"base_url"`
ApiKey string `mapstructure:"api_key"`
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

struct field ApiKey should be APIKey

@gmgigi96
Copy link
Member

Maybe "api" as name is too generic? I would call it "nextcloud" or "owncloud", like in the ocm share provider

@michielbdejong
Copy link
Contributor Author

michielbdejong commented Jun 13, 2023

@mrvahedi68 can you resolve the Hound smells and answer the reviewer comment above?

Also, I'm seeing this in the mesh.pondersource.org logs:

2023-06-13 10:41:21.076 ERR ../reva/cmd/revad/runtime/runtime.go:219 > error starting the grpc server error="unable to register services: rgrpc: grpc service ocminvitemanager could not be started,: failed to build resolver: passthrough: received empty target in Build()" pid=292622

do you know what might cause that?
This is my config:

[grpc.services.ocminvitemanager]
driver = "api"
provider_domain = "mesh.pondersource.org"

[grpc.services.ocminvitemanager.drivers.api]
base_url = "https://cloud.pondersource.org/"
api_key = "shared-secret-1"

@mrvahedi68
Copy link

@mrvahedi68 can you resolve the Hound smells and answer the reviewer comment above?

Also, I'm seeing this in the mesh.pondersource.org logs:

2023-06-13 10:41:21.076 ERR ../reva/cmd/revad/runtime/runtime.go:219 > error starting the grpc server error="unable to register services: rgrpc: grpc service ocminvitemanager could not be started,: failed to build resolver: passthrough: received empty target in Build()" pid=292622

do you know what might cause that? This is my config:

[grpc.services.ocminvitemanager]
driver = "api"
provider_domain = "mesh.pondersource.org"

[grpc.services.ocminvitemanager.drivers.api]
base_url = "https://cloud.pondersource.org/"
api_key = "shared-secret-1"

It is for missing gatewaysvc configuration inside api configuration section.
Like this:
[grpc.services.ocminvitemanager.drivers.api] base_url = "https://cloud.pondersource.org/" api_key = "shared-secret-1" gatewaysvc = "Put Here"

@glpatcern
Copy link
Member

Superseded by #4115

@glpatcern glpatcern closed this Aug 15, 2023
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.

4 participants