-
Notifications
You must be signed in to change notification settings - Fork 189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OCM. Restrict sharing roles to Editor / Viewer in sharing dialog #9745
Comments
@butonic the condition syntax is not for the clients. The server filters that based on the resource |
@micbar it cannot do that because the user first selects the resource and then searches for a recipient. web has to match the known roles with the available sharing roles AND the type of recipient. On the server side we currently do not have the share recipient available. |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
also note that when creating a federated share we store a grantee without the protocol in the idp. then when listing the shares the json repository tries to compare an idp with protocol, so users are never treated equal in: diff --git a/pkg/ocm/share/repository/json/json.go b/pkg/ocm/share/repository/json/json.go
index 139a320b4..5d21695b2 100644
--- a/pkg/ocm/share/repository/json/json.go
+++ b/pkg/ocm/share/repository/json/json.go
@@ -396,6 +396,10 @@ func (m *mgr) ListShares(ctx context.Context, user *userpb.User, filters []*ocm.
}
for _, share := range m.model.Shares {
+ // FIXME utils.UserEqual(user.Id, share.GetGrantee().GetUserId()) is false because the
+ // user.id.idp is "https://cloud.ocis.test"
+ // and the share.GetGrantee().GetUserId().idp is just "cloud.ocis.test"
+ // the protocol was deliberately removed from the idp in https://github.com/cs3org/reva/pull/1009
if utils.UserEqual(user.Id, share.Owner) || utils.UserEqual(user.Id, share.Creator) || utils.UserEqual(user.Id, share.GetGrantee().GetUserId()) {
// no filter we return earlier
if len(filters) == 0 { the protocol in the ocmprovider.json was deliberately removed in cs3org/reva#1009 a quickfix to create grantees with the protocol would be to use the user idp as is when creating shares diff --git a/services/graph/pkg/service/v0/api_driveitem_permissions.go b/services/graph/pkg/service/v0/api_driveitem_permissions.go
index 4c169b1d28..3b5299fa09 100644
--- a/services/graph/pkg/service/v0/api_driveitem_permissions.go
+++ b/services/graph/pkg/service/v0/api_driveitem_permissions.go
@@ -281,7 +281,7 @@ func createShareRequestToFederatedUser(user libregraph.User, resourceId *storage
Id: &storageprovider.Grantee_UserId{UserId: &userpb.UserId{
Type: userpb.UserType_USER_TYPE_FEDERATED,
OpaqueId: user.GetId(),
- Idp: providerInfo.Domain, // the domain is persisted in the grant as u:{opaqueid}:{domain}
+ Idp: *user.GetIdentities()[0].Issuer, // the domain is persisted in the grant as u:{opaqueid}:{domain}
}},
},
RecipientMeshProvider: providerInfo, |
This comment was marked as outdated.
This comment was marked as outdated.
We could use $filter on the @libre.graph.permissions.roles.allowedValues directly:
Granted, the formulated condition check is not perfect. it does not fully parse the SDDL, but we don't need to. I just want to have an Odata spec conforming request that expresses that the client only wants to have actions for federated users. Think of it as a fancy way of saying The client has to use a different url to get the ist of federated users. This is the only thing I can come up with that fits our libregraph spec. |
things I noticed when trying to create a user share
Content-Type: application/x-www-form-urlencoded
header. Why notapplication/json
? then the firefox devtools would know how to parse the body and allow navigating it properly...GET /drives/{driveid}/items/{itemid}/permissions
response. there all rolas have a different weight./roleManagement/permissions/roleDefinitions
endpointGET /drives/{driveid}/items/{itemid}/permissions
request that returns all allowd actions and roles./roleManagement/permissions/roleDefinitions
endpointwe can add two new roles (view and edit) for federated users, but it will require a new condition$ResourceIsSelf
and$SubjectIsOwner
@Subject.objectId == @Resource.objectId
and@Subject.objectId Any_of @Resource.owners
exists @Resource.Folder
,exists @Resource.File
andexists @Resource.Root
condition
property, anyway?exists @Resource.Folder
could behas @Resource.Folder
.The text was updated successfully, but these errors were encountered: