Add "no-op" action and use it as default for scope permissions (#1138)
Because of listing visibility, if no actions are assigned to a user for an individual resource, it's excluded from the list. This is fine and good. However, when we made a change in 0.2.0 to restrict the information returned from listing for the anonymous user for scopes and auth methods, it exposed the fact that because of the way this visibility works we had to add `read` to scopes by default -- thereby rather defeating the purpose of restricting what goes back to `u_anon` requests. The purpose of "no-op" is to never be used for real actions within the API, but as something that can be granted to specifically enable visibility for the targeted user. This makes the controls over list visibility much more granular.
This commit is contained in:
1 parent
c0bab5beff
commit
727d1c7085
33 files changed
+253
-206
No files matched your search
@@ -79,24 +79,24 @@ func TestListingScopeIds(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "perms on global, no groups",
|
||||
globalGrants: []string{"id=*;type=group;actions=list,read"},
|
||||
globalGrants: []string{"id=*;type=group;actions=list,no-op"},
|
||||
projGrants: []string{"id=*;type=group;actions=read"},
|
||||
recurseFrom: "global",
|
||||
},
|
||||
{
|
||||
name: "perms on org, no groups",
|
||||
orgGrants: []string{"id=*;type=group;actions=list,read"},
|
||||
orgGrants: []string{"id=*;type=group;actions=list,no-op"},
|
||||
projGrants: []string{"id=*;type=group;actions=read"},
|
||||
recurseFrom: "org",
|
||||
},
|
||||
{
|
||||
name: "perms on project, no groups",
|
||||
projGrants: []string{"id=*;type=group;actions=list,read"},
|
||||
projGrants: []string{"id=*;type=group;actions=list,no-op"},
|
||||
recurseFrom: "project",
|
||||
},
|
||||
{
|
||||
name: "perms on global, none in org",
|
||||
globalGrants: []string{"id=*;type=group;actions=list,read"},
|
||||
globalGrants: []string{"id=*;type=group;actions=list,no-op"},
|
||||
projGrants: []string{"id=*;type=group;actions=read"},
|
||||
globalGroups: 1,
|
||||
orgGroups: 3,
|
||||
@@ -106,7 +106,7 @@ func TestListingScopeIds(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "perms on global, none in org, start at org",
|
||||
globalGrants: []string{"id=*;type=group;actions=list,read"},
|
||||
globalGrants: []string{"id=*;type=group;actions=list,no-op"},
|
||||
projGrants: []string{"id=*;type=group;actions=read"},
|
||||
globalGroups: 1,
|
||||
orgGroups: 3,
|
||||
@@ -116,7 +116,7 @@ func TestListingScopeIds(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "perms on global, with org",
|
||||
globalGrants: []string{"id=*;type=group;actions=list,read"},
|
||||
globalGrants: []string{"id=*;type=group;actions=list,no-op"},
|
||||
orgGrants: []string{"id=*;type=group;actions=read"},
|
||||
projGrants: []string{"id=*;type=group;actions=read"},
|
||||
globalGroups: 1,
|
||||
@@ -127,7 +127,7 @@ func TestListingScopeIds(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "perms on global, with org, start at org",
|
||||
globalGrants: []string{"id=*;type=group;actions=list,read"},
|
||||
globalGrants: []string{"id=*;type=group;actions=list,no-op"},
|
||||
orgGrants: []string{"id=*;type=group;actions=read"},
|
||||
projGrants: []string{"id=*;type=group;actions=read"},
|
||||
globalGroups: 1,
|
||||
@@ -138,7 +138,7 @@ func TestListingScopeIds(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "perms on global, start at project",
|
||||
globalGrants: []string{"id=*;type=group;actions=list,read"},
|
||||
globalGrants: []string{"id=*;type=group;actions=list,no-op"},
|
||||
orgGrants: []string{"id=*;type=group;actions=read"},
|
||||
projGrants: []string{"id=*;type=group;actions=read"},
|
||||
globalGroups: 1,
|
||||
@@ -159,7 +159,7 @@ func TestListingScopeIds(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "perms on org, start at global, read on org",
|
||||
orgGrants: []string{"id=*;type=group;actions=list,read"},
|
||||
orgGrants: []string{"id=*;type=group;actions=list,no-op"},
|
||||
projGrants: []string{"id=*;type=group;actions=read"},
|
||||
globalGroups: 1,
|
||||
orgGroups: 3,
|
||||
@@ -169,7 +169,7 @@ func TestListingScopeIds(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "perms on org, start at org",
|
||||
orgGrants: []string{"id=*;type=group;actions=list,read"},
|
||||
orgGrants: []string{"id=*;type=group;actions=list,no-op"},
|
||||
projGrants: []string{"id=*;type=group;actions=read"},
|
||||
globalGroups: 1,
|
||||
orgGroups: 3,
|
||||
@@ -179,7 +179,7 @@ func TestListingScopeIds(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "perms on org, start at project",
|
||||
orgGrants: []string{"id=*;type=group;actions=list,read"},
|
||||
orgGrants: []string{"id=*;type=group;actions=list,no-op"},
|
||||
projGrants: []string{"id=*;type=group;actions=read"},
|
||||
globalGroups: 1,
|
||||
orgGroups: 3,
|
||||
@@ -189,7 +189,7 @@ func TestListingScopeIds(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "perms on proj",
|
||||
projGrants: []string{"id=*;type=group;actions=list,read"},
|
||||
projGrants: []string{"id=*;type=group;actions=list,no-op"},
|
||||
globalGroups: 1,
|
||||
orgGroups: 3,
|
||||
projGroups: 5,
|
||||
@@ -198,7 +198,7 @@ func TestListingScopeIds(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "perms on proj, start at org",
|
||||
projGrants: []string{"id=*;type=group;actions=list,read"},
|
||||
projGrants: []string{"id=*;type=group;actions=list,no-op"},
|
||||
globalGroups: 1,
|
||||
orgGroups: 3,
|
||||
projGroups: 5,
|
||||
@@ -207,7 +207,7 @@ func TestListingScopeIds(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "perms on proj, start at global",
|
||||
projGrants: []string{"id=*;type=group;actions=list,read"},
|
||||
projGrants: []string{"id=*;type=group;actions=list,no-op"},
|
||||
globalGroups: 1,
|
||||
orgGroups: 3,
|
||||
projGroups: 5,
|
||||
|
||||
Reference in new issue
Block a user