November 23, 2017


# Add user permission.
# This script adds a single permission to an user.
# Use the SoftLayer_User_Customer_CustomerPermission_Permission::getAllObjects method
# to retrieve a list of all permissions available in the SoftLayer.
# Important manual Pages:
# @License:
# @Author: SoftLayer Technologies, Inc. <>
require 'rubygems'
require 'softlayer_api'
require 'pp'

SL_API_USERNAME = 'set me'
SL_API_KEY = 'set me'

client = SL_API_USERNAME, api_key: SL_API_KEY)

# Set the user ID of the user you want to add permissions, yo can get them using
# The method SoftLayer_Account::getUsers.
user_id = 282_220

# In this example we are going to add permissions to the user
# to add tickets using SoftLayer_User_Customer::addPortalPermission method.
permission_template = {
  'keyName' => 'TICKET_ADD'

  # Define the connection to SoftLayer_User_Customer
  result = client['User_Customer'].object_with_id(user_id).addPortalPermission(permission_template)
rescue => error_reason
  puts "Error adding permission to the user #{error_reason}"


If this article contains any error, or leaves any of your questions unanswered, please help us out by opening up a github issue.
Open an issue