[ARVADOS] updated: 2.1.0-507-gf8de64e0e
Git user
git at public.arvados.org
Tue Mar 23 20:23:09 UTC 2021
Summary of changes:
doc/_config.yml | 2 +-
doc/api/methods/groups.html.textile.liquid | 2 +-
doc/api/permission-model.html.textile.liquid | 6 +--
.../topics => api}/projects.html.textile.liquid | 4 +-
lib/controller/localdb/conn.go | 48 ++++++++++++++++++++++
lib/controller/rpc/conn.go | 47 ---------------------
services/api/app/models/group.rb | 1 +
7 files changed, 56 insertions(+), 54 deletions(-)
rename doc/{user/topics => api}/projects.html.textile.liquid (98%)
via f8de64e0eecda005e2cb5b3e5f6bf980bbc82840 (commit)
from 840ba2f7cd2d6d73363b966691a07792a324025d (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit f8de64e0eecda005e2cb5b3e5f6bf980bbc82840
Author: Ward Vandewege <ward at curii.com>
Date: Tue Mar 23 16:22:56 2021 -0400
17119: implement review feedback.
Arvados-DCO-1.1-Signed-off-by: Ward Vandewege <ward at curii.com>
diff --git a/doc/_config.yml b/doc/_config.yml
index f519d229e..d2b6d62e4 100644
--- a/doc/_config.yml
+++ b/doc/_config.yml
@@ -44,7 +44,6 @@ navbar:
- user/tutorials/tutorial-keep-mount-os-x.html.textile.liquid
- user/tutorials/tutorial-keep-mount-windows.html.textile.liquid
- user/tutorials/tutorial-keep-collection-lifecycle.html.textile.liquid
- - user/topics/projects.html.textile.liquid
- user/topics/arv-copy.html.textile.liquid
- user/topics/collection-versioning.html.textile.liquid
- user/topics/storage-classes.html.textile.liquid
@@ -129,6 +128,7 @@ navbar:
- api/keep-webdav.html.textile.liquid
- api/keep-s3.html.textile.liquid
- api/keep-web-urls.html.textile.liquid
+ - api/projects.html.textile.liquid
- api/methods/collections.html.textile.liquid
- api/methods/repositories.html.textile.liquid
- Container engine:
diff --git a/doc/api/methods/groups.html.textile.liquid b/doc/api/methods/groups.html.textile.liquid
index 4b63de5de..e4b8594dd 100644
--- a/doc/api/methods/groups.html.textile.liquid
+++ b/doc/api/methods/groups.html.textile.liquid
@@ -25,7 +25,7 @@ Each Group has, in addition to the "Common resource fields":{{site.baseurl}}/api
table(table table-bordered table-condensed).
|_. Attribute|_. Type|_. Description|_. Example|
|name|string|||
-|group_class|string|Type of group. @project@ and @filter@ indicate that the group should be displayed by Workbench and arv-mount as a project for organizing and naming objects. @role@ means FIXME. |@"filter"@
+|group_class|string|Type of group. @project@ and @filter@ indicate that the group should be displayed by Workbench and arv-mount as a project for organizing and naming objects. @role@ is used as part of the "permission system":{{site.baseurl}}/api/permission-model.html. |@"filter"@
@"project"@
@"role"@|
|description|text|||
diff --git a/doc/api/permission-model.html.textile.liquid b/doc/api/permission-model.html.textile.liquid
index f54dc8bf2..d9e16e047 100644
--- a/doc/api/permission-model.html.textile.liquid
+++ b/doc/api/permission-model.html.textile.liquid
@@ -26,7 +26,7 @@ There are four levels of permission: *none*, *can_read*, *can_write*, and *can_m
h2. Ownership
-All Arvados objects have an @owner_uuid@ field. Valid uuid types for @owner_uuid@ are "User" and "Group". For Group, the @group_class@ must be "filter", "project" or "role".
+All Arvados objects have an @owner_uuid@ field. Valid uuid types for @owner_uuid@ are "User" and "Group". In the case of a Group, the @group_class@ must be "project".
The User or Group specified by @owner_uuid@ has *can_manage* permission on the object. This permission is one way: an object that is owned does not get any special permissions on the User or Group that owns it.
@@ -67,8 +67,8 @@ A "project" is a subtype of Group that is displayed as a "Project" in Workbench,
* Projects can be targets (@head_uuid@) of permission links, but not origins (@tail_uuid@). Putting a project in a @tail_uuid@ field is an error.
A "filter" is a subtype of Group that is displayed as a "Project" in Workbench, and as a directory by @arv-mount at . See "the groups API documentation":/api/methods/groups.html for more information.
-* A filter cannot own things (cannot appear in @owner_uuid@). Putting a role in an @owner_uuid@ field is an error.
-* A filter can be owned by a user or another project.
+* A filter group cannot own things (cannot appear in @owner_uuid@). Putting a role in an @owner_uuid@ field is an error.
+* A filter group can be owned by a user or a project.
* The name of a filter is unique only among projects and filters with the same owner_uuid.
* Filters can be targets (@head_uuid@) of permission links, but not origins (@tail_uuid@). Putting a filter in a @tail_uuid@ field is an error.
diff --git a/doc/user/topics/projects.html.textile.liquid b/doc/api/projects.html.textile.liquid
similarity index 98%
rename from doc/user/topics/projects.html.textile.liquid
rename to doc/api/projects.html.textile.liquid
index a23ff528a..b1c74fe0d 100644
--- a/doc/user/topics/projects.html.textile.liquid
+++ b/doc/api/projects.html.textile.liquid
@@ -1,7 +1,7 @@
---
layout: default
-navsection: userguide
-title: "Projects"
+navsection: api
+title: "Projects and filter groups"
...
{% comment %}
Copyright (C) The Arvados Authors. All rights reserved.
diff --git a/lib/controller/localdb/conn.go b/lib/controller/localdb/conn.go
index d197675f8..c6b70ed2e 100644
--- a/lib/controller/localdb/conn.go
+++ b/lib/controller/localdb/conn.go
@@ -6,6 +6,8 @@ package localdb
import (
"context"
+ "fmt"
+ "strings"
"git.arvados.org/arvados.git/lib/controller/railsproxy"
"git.arvados.org/arvados.git/lib/controller/rpc"
@@ -45,3 +47,49 @@ func (conn *Conn) Login(ctx context.Context, opts arvados.LoginOptions) (arvados
func (conn *Conn) UserAuthenticate(ctx context.Context, opts arvados.UserAuthenticateOptions) (arvados.APIClientAuthorization, error) {
return conn.loginController.UserAuthenticate(ctx, opts)
}
+
+func (conn *Conn) GroupContents(ctx context.Context, options arvados.GroupContentsOptions) (arvados.ObjectList, error) {
+ // The requested UUID can be a user (virtual home project), which we just pass on to
+ // the API server.
+ if strings.Index(options.UUID, "j7d0g") != 6 {
+ return conn.railsProxy.GroupContents(ctx, options)
+ }
+
+ var resp arvados.ObjectList
+
+ // Get the group object
+ respGroup, err := conn.GroupGet(ctx, arvados.GetOptions{UUID: options.UUID})
+ if err != nil {
+ return resp, err
+ }
+
+ // If the group has groupClass 'filter', apply the filters before getting the contents.
+ if respGroup.GroupClass == "filter" {
+ if filters, ok := respGroup.Properties["filters"].([]interface{}); ok {
+ for _, f := range filters {
+ // f is supposed to be a []string
+ tmp, ok2 := f.([]interface{})
+ if !ok2 || len(tmp) < 3 {
+ return resp, fmt.Errorf("filter unparsable: %T, %+v, original field: %T, %+v\n", tmp, tmp, f, f)
+ }
+ var filter arvados.Filter
+ if attr, ok2 := tmp[0].(string); ok2 {
+ filter.Attr = attr
+ } else {
+ return resp, fmt.Errorf("filter unparsable: attribute must be string: %T, %+v, filter: %T, %+v\n", tmp[0], tmp[0], f, f)
+ }
+ if operator, ok2 := tmp[1].(string); ok2 {
+ filter.Operator = operator
+ } else {
+ return resp, fmt.Errorf("filter unparsable: operator must be string: %T, %+v, filter: %T, %+v\n", tmp[1], tmp[1], f, f)
+ }
+ filter.Operand = tmp[2]
+ options.Filters = append(options.Filters, filter)
+ }
+ }
+ // Use the generic /groups/contents endpoint for filter groups
+ options.UUID = ""
+ }
+
+ return conn.railsProxy.GroupContents(ctx, options)
+}
diff --git a/lib/controller/rpc/conn.go b/lib/controller/rpc/conn.go
index 9d64dc539..801650395 100644
--- a/lib/controller/rpc/conn.go
+++ b/lib/controller/rpc/conn.go
@@ -445,53 +445,6 @@ func (conn *Conn) GroupList(ctx context.Context, options arvados.ListOptions) (a
return resp, err
}
-func (conn *Conn) GroupContents(ctx context.Context, options arvados.GroupContentsOptions) (arvados.ObjectList, error) {
- // The requested UUID can be a user (virtual home project), which we just pass on to
- // the API server.
- if strings.Index(options.UUID, "j7d0g") != 6 {
- ep := arvados.EndpointGroupContents
- var resp arvados.ObjectList
- err := conn.requestAndDecode(ctx, &resp, ep, nil, options)
- return resp, err
- }
-
- log := ctxlog.FromContext(ctx)
- var resp arvados.ObjectList
-
- // Get the group object
- epGet := arvados.EndpointGroupGet
- var respGroup arvados.Group
- err := conn.requestAndDecode(ctx, &respGroup, epGet, nil, options)
- if err != nil {
- return resp, err
- }
-
- // If the group has groupClass 'filter', apply the filters before getting the contents.
- if respGroup.GroupClass == "filter" {
- if filters, ok := respGroup.Properties["filters"]; ok {
- for _, f := range filters.([]interface{}) {
- // f is supposed to be a []string
- tmp, ok2 := f.([]interface{})
- if !ok2 || len(tmp) < 3 {
- log.Warnf("filter unparsable: %T, %+v, original field: %T, %+v\n", tmp, tmp, f, f)
- continue
- }
- var filter arvados.Filter
- filter.Attr = tmp[0].(string)
- filter.Operator = tmp[1].(string)
- filter.Operand = tmp[2]
- options.Filters = append(options.Filters, filter)
- }
- }
- // Use the generic /groups/contents endpoint for filter groups
- options.UUID = ""
- }
-
- ep := arvados.EndpointGroupContents
- err = conn.requestAndDecode(ctx, &resp, ep, nil, options)
- return resp, err
-}
-
func (conn *Conn) GroupShared(ctx context.Context, options arvados.ListOptions) (arvados.GroupList, error) {
ep := arvados.EndpointGroupShared
var resp arvados.GroupList
diff --git a/services/api/app/models/group.rb b/services/api/app/models/group.rb
index 2243ae54d..fd2f5f18c 100644
--- a/services/api/app/models/group.rb
+++ b/services/api/app/models/group.rb
@@ -60,6 +60,7 @@ class Group < ArvadosModel
def check_filter_group_filters
if group_class == 'filter'
if !self.properties.key?("filters")
+ errors.add :properties, "filters property missing, it must be an array of arrays, each with 3 elements"
return
end
if !self.properties["filters"].is_a?(Array)
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list