Skip to content
Snippets Groups Projects
Commit 0c345a59 authored by Gospodin Bodurov's avatar Gospodin Bodurov
Browse files

Merge branch '391-device-management-ability-to-authorize-new-device' into 'master'

391 device management ability to authorize new device

See merge request !38
parents 21f2ab65 e36cbd43
No related branches found
No related tags found
2 merge requests!39Master,!38391 device management ability to authorize new device
......@@ -26,6 +26,28 @@ import (
"golang.org/x/net/context"
)
func (s *KeyStorageServerImpl) SetAuthorized(ctx context.Context, in *api.SetAuthorizedRequest) (*api.SetAuthorizedResponse, error) {
setAuthorizedResponse := &api.SetAuthorizedResponse{}
setAuthorizedResponse.StatusList = s.updateAll(ctx, in.Uuid, func(k *api.Key) { k.Unauthorized = !in.Value })
if setAuthorizedResponse.StatusList != nil {
return setAuthorizedResponse, nil
}
setAuthorizedResponse.StatusList = utils.AddStatus(setAuthorizedResponse.StatusList, "200", api.StatusType_INFO, "Keys authorization updated")
return setAuthorizedResponse, nil
}
func (s *KeyStorageServerImpl) Destroy(ctx context.Context, in *api.DestroyRequest) (*api.DestroyResponse, error) {
destroyResponse := &api.DestroyResponse{}
destroyResponse.StatusList = s.updateAll(ctx, in.Uuid, func(k *api.Key) { k.Destroyed = true })
if destroyResponse.StatusList != nil {
return destroyResponse, nil
}
destroyResponse.StatusList = utils.AddStatus(destroyResponse.StatusList, "200", api.StatusType_INFO, "Keys destroyed")
return destroyResponse, nil
}
func (s *KeyStorageServerImpl) Revoke(ctx context.Context, in *api.RevokeRequest) (*api.RevokeResponse, error) {
revokeResponse := &api.RevokeResponse{}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment