Group Users

A GroupUser is a record about membership of a User within a Group.

Creating GroupUsers

GroupUsers can be created via the normal create action. When using the update action, if the GroupUser record does not exist for the given user/group IDs it will be created.

List Group Users

SDK Method

Files::GroupUser.list

Return Object

List<GroupUser>

Authorization Requirement

Available to all authenticated keys or sessions.

Method Arguments

Parameter access is subject to this endpoint's authorization requirement and the caller's access to the affected resource. Site Administrator access also includes Site-Wide API keys.

ArgumentDescription
group_id
int64
Group ID. If provided, returns memberships of this group. Requires a Site Administrator, a Read-only Administrator, a Workspace Administrator for the group's workspace, or a Group Administrator of this group.
user_id
int64
User ID. If provided, will return group_users of this user.

Can be set by: Site Administrator; Read-only Administrator; Workspace Administrator.

Additional Arguments

Example Request

begin
  group_users = Files::GroupUser.list(
    group_id: 1
  )
  group_users.auto_paging_each do |group_user|
    # Operate on group_user
  end
rescue Files::NotAuthenticatedError => e
  puts "Authentication Error Occurred (#{e.class.to_s}): " + e.message
rescue Files::Error => e
  puts "Unknown Error Occurred (#{e.class.to_s}): " + e.message
end

Create Group User

SDK Method

Files::GroupUser.create

Return Object

GroupUser

Authorization Requirement

Requires a Site-Wide API key, or a User API key or session from a Site Administrator, a Workspace Administrator for the relevant workspace, or a Group Administrator for the relevant group.

Method Arguments

Parameter access is subject to this endpoint's authorization requirement and the caller's access to the affected resource. Site Administrator access also includes Site-Wide API keys.

ArgumentDescription
group_id
int64
Required
Group ID to add user to.

Can be set by: Site Administrator; Workspace Administrator; Group Administrator.
user_id
int64
Required
User ID to add to group.

Can be set by: Site Administrator; Workspace Administrator; Group Administrator.
admin
boolean
Is the user a group administrator?

Can be set by: Site Administrator; Workspace Administrator.

Example Request

begin
  group_user = Files::GroupUser.create(
    group_id: 1,
    user_id: 1
  )
  # Operate on group_user
rescue Files::NotAuthenticatedError => e
  puts "Authentication Error Occurred (#{e.class.to_s}): " + e.message
rescue Files::Error => e
  puts "Unknown Error Occurred (#{e.class.to_s}): " + e.message
end

Update Group User

SDK Method

group_user.update

Return Object

GroupUser

Authorization Requirement

Requires a Site-Wide API key, or a User API key or session from a Site Administrator, a Workspace Administrator for the relevant workspace, or a Group Administrator for the relevant group.

Method Arguments

Parameter access is subject to this endpoint's authorization requirement and the caller's access to the affected resource. Site Administrator access also includes Site-Wide API keys.

ArgumentDescription
group_id
int64
Required
Group ID to add user to.

Can be set by: Site Administrator; Workspace Administrator; Group Administrator.
user_id
int64
Required
User ID to add to group.

Can be set by: Site Administrator; Workspace Administrator; Group Administrator.
admin
boolean
Is the user a group administrator?

Can be set by: Site Administrator; Workspace Administrator.

Example Request

begin
  group_user = Files::GroupUser.list.first
  group_user.update(
    group_id: 1,
    user_id: 1,
    admin: false
  )
rescue Files::NotAuthenticatedError => e
  puts "Authentication Error Occurred (#{e.class.to_s}): " + e.message
rescue Files::Error => e
  puts "Unknown Error Occurred (#{e.class.to_s}): " + e.message
end

Delete Group User

SDK Method

group_user.delete

Return Object

nil

Authorization Requirement

Requires a Site-Wide API key, or a User API key or session from a Site Administrator, a Workspace Administrator for the relevant workspace, or a Group Administrator for the relevant group.

Method Arguments

ArgumentDescription
group_id
int64
Required
Group ID from which to remove user.
user_id
int64
Required
User ID to remove from group.

Example Request

begin
  group_user = Files::GroupUser.list.first
  group_user.delete(
    group_id: 1,
    user_id: 1
  )
rescue Files::NotAuthenticatedError => e
  puts "Authentication Error Occurred (#{e.class.to_s}): " + e.message
rescue Files::Error => e
  puts "Unknown Error Occurred (#{e.class.to_s}): " + e.message
end

The GroupUser Object

Some of the methods above return a GroupUser object. The attributes of this object are listed below.

AttributeDescription
group_name
string
Group name
group_id
int64
Group ID
user_id
int64
User ID
admin
boolean
Is this user an administrator of this group?
username
string
Username of the user