Skip to content

Commit

Permalink
core: rename crosscore-readonly to crosscore
Browse files Browse the repository at this point in the history
The `rpc/submit` endpoint isn't actually read-only, so this is a more
accurate name. 


Closes #1061
  • Loading branch information
tessr authored and iampogo committed Apr 26, 2017
1 parent 9cadcdc commit 2dad439
Show file tree
Hide file tree
Showing 10 changed files with 65 additions and 65 deletions.
2 changes: 1 addition & 1 deletion cmd/corectl/main.go
Expand Up @@ -227,7 +227,7 @@ func createToken(client *rpc.Client, args []string) {
case len(args) == 2:
grant.Policy = args[1]
case *flagNet:
grant.Policy = "crosscore-readonly"
grant.Policy = "crosscore"
fmt.Fprintln(os.Stderr, "warning: the network flag is deprecated")
default:
grant.Policy = "client-readwrite"
Expand Down
2 changes: 1 addition & 1 deletion core/access_tokens.go
Expand Up @@ -46,7 +46,7 @@ func (a *API) createAccessToken(ctx context.Context, x struct{ ID, Type string }
grant = authz.Grant{
GuardType: "access_token",
GuardData: guardData,
Policy: "crosscore-readonly",
Policy: "crosscore",
}
default:
// We've already returned if x.Type wasn't specified, so this must be a bad type.
Expand Down
16 changes: 8 additions & 8 deletions core/authz.go
Expand Up @@ -5,7 +5,7 @@ const grantPrefix = "/core/grant/"
var policies = []string{
"client-readwrite",
"client-readonly",
"crosscore-readonly",
"crosscore",
"monitoring",
"internal",
"public",
Expand Down Expand Up @@ -39,12 +39,12 @@ var policyByRoute = map[string][]string{
"/list-unspent-outputs": {"client-readwrite", "client-readonly"},
"/reset": {"client-readwrite", "internal"},

networkRPCPrefix + "submit": {"crosscore-readonly"},
networkRPCPrefix + "get-block": {"crosscore-readonly"},
networkRPCPrefix + "get-snapshot-info": {"crosscore-readonly"},
networkRPCPrefix + "get-snapshot": {"crosscore-readonly"},
networkRPCPrefix + "signer/sign-block": {"crosscore-readonly"}, // TODO(tessr): make this crosscore-signblock
networkRPCPrefix + "block-height": {"crosscore-readonly"},
networkRPCPrefix + "submit": {"crosscore"},
networkRPCPrefix + "get-block": {"crosscore"},
networkRPCPrefix + "get-snapshot-info": {"crosscore"},
networkRPCPrefix + "get-snapshot": {"crosscore"},
networkRPCPrefix + "signer/sign-block": {"crosscore"}, // TODO(tessr): make this crosscore-signblock
networkRPCPrefix + "block-height": {"crosscore"},

"/list-authorization-grants": {"client-readwrite", "client-readonly"},
"/create-authorization-grant": {"client-readwrite"},
Expand All @@ -53,7 +53,7 @@ var policyByRoute = map[string][]string{
"/list-access-tokens": {"client-readwrite", "client-readonly"},
"/delete-access-token": {"client-readwrite"},
"/configure": {"client-readwrite", "internal"},
"/info": {"client-readwrite", "client-readonly", "crosscore-readonly", "monitoring"},
"/info": {"client-readwrite", "client-readonly", "crosscore", "monitoring"},

"/debug/vars": {"client-readwrite", "client-readonly", "monitoring"}, // should monitoring endpoints also be available to any other policy-holders?
"/debug/pprof": {"client-readwrite", "client-readonly", "monitoring"},
Expand Down
98 changes: 49 additions & 49 deletions core/authz_test.go
Expand Up @@ -57,7 +57,7 @@ func TestAuthz(t *testing.T) {
testPolicies := []string{
"client-readwrite",
"client-readonly",
"crosscore-readonly",
"crosscore",
"monitoring",
"internal",
"public",
Expand All @@ -81,68 +81,68 @@ func TestAuthz(t *testing.T) {

pathTokenMap := map[string]map[string]bool{
"/create-account": map[string]bool{
"client-readwrite": true,
"client-readonly": false,
"crosscore-readonly": false,
"monitoring": false,
"internal": false,
"public": false,
"client-readwrite": true,
"client-readonly": false,
"crosscore": false,
"monitoring": false,
"internal": false,
"public": false,
},
"/list-accounts": map[string]bool{
"client-readwrite": true,
"client-readonly": true,
"crosscore-readonly": false,
"monitoring": false,
"internal": false,
"public": false,
"client-readwrite": true,
"client-readonly": true,
"crosscore": false,
"monitoring": false,
"internal": false,
"public": false,
},
"/reset": map[string]bool{
"client-readwrite": true,
"client-readonly": false,
"crosscore-readonly": false,
"monitoring": false,
"internal": true,
"public": false,
"client-readwrite": true,
"client-readonly": false,
"crosscore": false,
"monitoring": false,
"internal": true,
"public": false,
},
networkRPCPrefix + "get-block": map[string]bool{
"client-readwrite": false,
"client-readonly": false,
"crosscore-readonly": true,
"monitoring": false,
"internal": false,
"public": false,
"client-readwrite": false,
"client-readonly": false,
"crosscore": true,
"monitoring": false,
"internal": false,
"public": false,
},
"/info": map[string]bool{
"client-readwrite": true,
"client-readonly": true,
"crosscore-readonly": true,
"monitoring": true,
"internal": false,
"public": false,
"client-readwrite": true,
"client-readonly": true,
"crosscore": true,
"monitoring": true,
"internal": false,
"public": false,
},
"/debug/pprof/symbol": map[string]bool{
"client-readwrite": true,
"client-readonly": true,
"crosscore-readonly": false,
"monitoring": true,
"internal": false,
"public": false,
"client-readwrite": true,
"client-readonly": true,
"crosscore": false,
"monitoring": true,
"internal": false,
"public": false,
},
"/raft/msg": map[string]bool{
"client-readwrite": false,
"client-readonly": false,
"crosscore-readonly": false,
"monitoring": false,
"internal": true,
"public": false,
"client-readwrite": false,
"client-readonly": false,
"crosscore": false,
"monitoring": false,
"internal": true,
"public": false,
},
"/dashboard": map[string]bool{ // public is open to all
"client-readwrite": true,
"client-readonly": true,
"crosscore-readonly": true,
"monitoring": true,
"internal": true,
"public": true,
"client-readwrite": true,
"client-readonly": true,
"crosscore": true,
"monitoring": true,
"internal": true,
"public": true,
},
}

Expand Down
2 changes: 1 addition & 1 deletion core/config/config.go
Expand Up @@ -323,7 +323,7 @@ func migrateAccessTokens(ctx context.Context, db pg.DB, rDB *raft.Service) error
case "client":
grant.Policy = "client-readwrite"
case "network":
grant.Policy = "crosscore-readonly"
grant.Policy = "crosscore"
}
_, err = authz.StoreGrant(ctx, rDB, grant, grantPrefix)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion generated/rev/RevId.java
@@ -1,4 +1,4 @@

public final class RevId {
public final String Id = "main/rev3018";
public final String Id = "main/rev3019";
}
2 changes: 1 addition & 1 deletion generated/rev/revid.go
@@ -1,3 +1,3 @@
package rev

const ID string = "main/rev3018"
const ID string = "main/rev3019"
2 changes: 1 addition & 1 deletion generated/rev/revid.js
@@ -1,2 +1,2 @@

export const rev_id = "main/rev3018"
export const rev_id = "main/rev3019"
2 changes: 1 addition & 1 deletion generated/rev/revid.rb
@@ -1,4 +1,4 @@

module Chain::Rev
ID = "main/rev3018".freeze
ID = "main/rev3019".freeze
end
2 changes: 1 addition & 1 deletion net/http/authz/loopback_authz.go
Expand Up @@ -7,7 +7,7 @@ func init() {
&Grant{GuardType: "localhost", Policy: "client-readwrite"},
&Grant{GuardType: "localhost", Policy: "client-readonly"},
&Grant{GuardType: "localhost", Policy: "monitoring"},
&Grant{GuardType: "localhost", Policy: "crosscore-readonly"},
&Grant{GuardType: "localhost", Policy: "crosscore"},
&Grant{GuardType: "localhost", Policy: "internal"},
)
}

0 comments on commit 2dad439

Please sign in to comment.