forked from lialvin/uos-go
-
Notifications
You must be signed in to change notification settings - Fork 1
/
updateauth.go
41 lines (37 loc) · 1.19 KB
/
updateauth.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
package system
import "github.com/tkblack/uos-go"
// NewUpdateAuth creates an action from the `wxbio.system` contract
// called `updateauth`.
//
// usingPermission needs to be `owner` if you want to modify the
// `owner` authorization, otherwise `active` will do for the rest.
func NewUpdateAuth(account uos.AccountName, permission, parent uos.PermissionName, authority uos.Authority, usingPermission uos.PermissionName) *uos.Action {
a := &uos.Action{
Account: AN("wxbio"),
Name: ActN("updateauth"),
Authorization: []uos.PermissionLevel{
{
Actor: account,
Permission: usingPermission,
},
},
ActionData: uos.NewActionData(UpdateAuth{
Account: account,
Permission: permission,
Parent: parent,
Auth: authority,
}),
}
return a
}
// UpdateAuth represents the hard-coded `updateauth` action.
//
// If you change the `active` permission, `owner` is the required parent.
//
// If you change the `owner` permission, there should be no parent.
type UpdateAuth struct {
Account uos.AccountName `json:"account"`
Permission uos.PermissionName `json:"permission"`
Parent uos.PermissionName `json:"parent"`
Auth uos.Authority `json:"auth"`
}