forked from keybase/client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rpc_exim.go
43 lines (33 loc) · 1.14 KB
/
rpc_exim.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Copyright 2015 Keybase, Inc. All rights reserved. Use of
// this source code is governed by the included BSD license.
// Export-Import for RPC for Teams
package teams
import (
"golang.org/x/net/context"
keybase1 "github.com/keybase/client/go/protocol/keybase1"
)
func (t *Team) ExportToTeamPlusApplicationKeys(ctx context.Context, idTime keybase1.Time, application keybase1.TeamApplication) (ret keybase1.TeamPlusApplicationKeys, err error) {
applicationKeys, err := t.AllApplicationKeys(ctx, application)
if err != nil {
return ret, err
}
members, err := t.Members()
if err != nil {
return ret, err
}
var writers []keybase1.UserVersion
var onlyReaders []keybase1.UserVersion
writers = append(writers, members.Writers...)
writers = append(writers, members.Admins...)
writers = append(writers, members.Owners...)
onlyReaders = append(onlyReaders, members.Readers...)
ret = keybase1.TeamPlusApplicationKeys{
Id: t.chain().GetID(),
Name: t.Name().String(),
Application: application,
Writers: writers,
OnlyReaders: onlyReaders,
ApplicationKeys: applicationKeys,
}
return ret, nil
}