Assigning a single user or group to a role for a folderSince 8/2015
Added by IBM contributorElizabeth Bowling on August 21, 2015
Rate this article 1 starsRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars

Assign a single user or group to a folder's access role.

This method requires authentication.

To assign a user or group to an access role, the currently authenticated user must be either: the owner of the folder, an administrator, or a user who has received GrantAccess permission on the folder. GrantAccess permission is given through the Manager access role. To test whether the current user can assign a user or group to a role, use the API for Retrieving the list of members for a folder's role to see if the user belongs to the Manager Role.

Note : When a user/group is assigned to a new role, the old role is automatically deleted.

The following access roles are available:

Role Type Permissions
Reader View a folder and all media in it.
Contributor Add to a folder and delete items they added.
Manager Add and remove any item; assign roles.

 

The following error codes could appear in a response body for an invalid request:

Error Code Description
Unknown Returned when the cause of an error is unknown
AccessDenied Returned when the cause of an error is due to a permission restriction
ItemNotFound Returned when the cause of an error is related to a resource not being found
ItemExists Returned when the cause of an error is related to a conflict with an existing resource
Unsupported Operation Returned when the operation is not supported
ConstraintViolation Returned when a constraint is violated such as description or summary being too long
Input
Method URI Description
POST /files/{auth}/api/collection/{collection-id}/roles/{role-type}/members Assign a user or group to the specified role for the specified folder.
POST /files/{auth}/api/communitycollection/{community-id}/roles/{role-type}/members Assign a user or group to the specified role for the specified community folder.
Name Type Optional Description
auth
enumerated No The authorization protocol being used by your application to access Connections Cloud.
Authorized values:
  • basic
  • oauth
collection-id
string No The UUID of the folder where the user is being assigned to an access role.
community-id
string No The UUID of the community folder where the user is being assigned to an access role.
role-type
enumerated No The role to which the current user is being assigned:
Reader: View a folder and all media in it.
Contributor: Add to a folder and delete items they added.
Manager: Add and remove any item; assign roles.
Authorized values:
  • reader
  • contributor
  • manager
Name Type Optional Description
sendNotification
enumerated Yes Determines whether a notification will be sent out when sharing a collection. The default value is true (notification will be sent).
Authorized values:
  • true
  • false
Name Type Optional Description
Authorization
enumerated No The authentication mechanism selected by your application to access the API.
Basic is the Base64 encoding of the IBM Connections Cloud username and password: Base64(username:password). For example, Base64(twatson@us.ibm.com:password).
Bearer is the oauth 2.0 access token that is generated when the user grants your application access to IBM Connections Cloud services.
See the reference topic "OAuth 2.0 APIs for web server flow" for more information.
Authorized values:
  • basic
  • bearer
Output
Code Description
401
Unauthorized. Returned when no authenticated user or no userid, email, or key parameter are provided on the request.
Examples
Assign the current user to the Contributor role for the specified folder.
POST /files/basic/api/collection/21aaffab-90db-4611-9b83-403255489186/roles/contributor/members HTTP/1.1

Response returned by the server
HTTP/1.1 201 Created

X-LCONN-API-IMCOMPITABLE: api


<entry xmlns:td="urn:ibm.com/td" xmlns="http://www.w3.org/2005/Atom" xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:snx="http://www.ibm.com/xmlns/prod/sn" xmlns:thr="http://purl.org/syndication/thread/1.0">
   <title type="text">Andreas Berzat</title>
   <id>ca:/collection/21aaffab-90db-4611-9b83-403255489186/roles/contributor/members/aberzat</id>
   <link href="https://filesvm004.cn.ibm.com:9443/files/basic/api/collection/21aaffab-90db-4611-9b83-403255489186/roles/contributor/members/aberzat" rel="self"></link>
   <link href="https://filesvm004.cn.ibm.com:9443/files/basic/api/collection/21aaffab-90db-4611-9b83-403255489186/roles/contributor/members/aberzat" rel="edit"></link>
   <content type="text">
      <ca:member xmlns:snx="http://www.ibm.com/xmlns/prod/sn" xmlns:ca="http://www.ibm.com/xmlns/prod/composite-applications/v1.0" ca:id="aberzat" ca:type="user" ca:email="aberzat@renovations.com" snx:userState="active" ca:display-name="Andreas Berzat"></ca:member>
   </content>
</entry>