Skip to content
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

YARD Documentation Enhancement #79

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 63 additions & 17 deletions lib/jss/api_object/directory_binding.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
### Copyright 2019 Rixar
### Copyright 2019 Pixar

###
### Licensed under the Apache License, Version 2.0 (the "Apache License")
Expand Down Expand Up @@ -55,7 +55,8 @@ class DirectoryBinding < JSS::APIObject
# Class Constants
#####################################

#! You CAN update this

# The directory binding type
DIRECTORY_BINDING_TYPE = {
open_directory: "Open Directory",
active_directory: "Active Directory",
Expand All @@ -64,13 +65,14 @@ class DirectoryBinding < JSS::APIObject
centrify: "Centrify"
}.freeze

# The directory binding type class hash used to determine which directory binding type class should be used
DIRECTORY_BINDING_TYPE_CLASSES = {
"Open Directory" => JSS::DirectoryBindingType::OpenDirectory,
"Active Directory" => JSS::DirectoryBindingType::ActiveDirectory,
"PowerBroker Identity Services" => JSS::DirectoryBindingType::PowerBroker,
"ADmitMac" => JSS::DirectoryBindingType::ADmitMac,
"Centrify" => JSS::DirectoryBindingType::Centrify
}
}.freeze

# The base for REST resources of this class
RSRC_BASE = 'directorybindings'.freeze
Expand All @@ -89,23 +91,59 @@ class DirectoryBinding < JSS::APIObject

# Attributes
#####################################

# @return [Integer] The Id of the object in the JSS
attr_reader :id

# @return [String] The name of the object in the JSS
attr_reader :name

# @return [Integer] The priority this binding has over others when multiple bindings are applied
attr_reader :priority

## @return [String] The domain server the binding will attempt to perform the bind to
attr_reader :domain

# @return [String] The username that will be used to perform the binding
attr_reader :username

# @return [String] The SHA256 hash of the user's password that would be used to perform the bind
attr_reader :password_sha256

# @return [String] The OU the computer object will reside in upon successful binding
attr_reader :computer_ou

# @return [String] The type of binding
attr_reader :type

# @return [JSS::DirectoryBindingType] The DirectoryBindingType object that hold the settings for the specific directory binding type configured.
attr_reader :type_settings

# @note This is only available if the object is newly created and stored locally
# @return [String] The user's password that would be used to perform the bind
attr_reader :password

# Constructor
# @see JSS::APIObject.initialize
# @note When creating an object with specific properties use the
# objects name and then the settings.
# Ex: Creating an Active Directory object:
# JSS::DirectoryBinding.make name: "Example Binding", username: "BindingUser", password: "SuperMonkey123", computer_ou: "computers", active_directory: { multiple_domains: false }, domain: your.domain.server
#####################################

# When creating a new directory binding in the JSS, you must provide :username, :password, :domain, :type, :name, :computer_ou, and the specific symbol for the binding type object.
# @see JSS::APIObject#initialize
# @note When creating an object with specific properties use the objects name and then the settings.
# @param [Hash] args The options to create the Directory Binding object.
# @option args [Integer] :priority What level of priority does this binding have over others, lower is higher priority
# @option args [String] :domain The domain server you want this binding to perform the bind to
# @option args [String] :username The username of the account that has permission to perform the bind to the specified server
# @option args [String] :password The password to be used by the account to perform the bind.
# @option args [String] :password_sha256 The SHA256 hash of the password for the account being used to perform the bind to the specified server.
# @option args [String] :computer_ou The OU path that the computer object is to reside in
# @option args [String] :type The type of binding object, must be one of DIRECTORY_BINDING_TYPEs
# @option args [Hash] :active_directory The settings you want to be passed to create the Active Directory binding type object.
# @option args [Hash] :open_directory The settings you want to be passed to create the Open Directory binding type object.
# @option args [Hash] :powerbroker_identity_services The settings you want to be passed to create the PowerBroker binding type object.
# @option args [Hash] :admitmac The settings you want to be passed to create the ADmitMac binding type object.
# @option args [Hash] :centrify The settings you want to be passed to create the Centrify binding type object.
# @example Creating an Active Directory object
# JSS::DirectoryBinding.make name: "Example Binding", username: "BindingUser", password: "SuperMonkey123", computer_ou: "computers", active_directory: { multiple_domains: false }, domain: your.domain.server
#####################################
def initialize(args = {})
super args
Expand Down Expand Up @@ -145,20 +183,26 @@ def initialize(args = {})

end

end
end # init

# Public Instance Methods
#####################################

# The domain the device will be bound to.
# @see Creatable#create
#
# @author Tyler Morgan
# @todo fill out this documentation
#
# @param newvalue [String]
def create()
super()
end

# Set the domain that the binding object will attempt to bind to.
#
# @raise [JSS::InvalidDataError] If newvalue is not a String
# @param newvalue [String] The domain server address attempting to be bound to
#
# @return [void]
# @raise [JSS::InvalidDataError] If the domain attempting to be set is not a String
#
# @return [Void]
def domain=(newvalue)
raise JSS::InvalidDataError, "Domain must be a String" unless newvalue.is_a? String

Expand All @@ -171,11 +215,11 @@ def domain=(newvalue)
#
# @author Tyler Morgan
#
# @param newvalue [String]
# @param newvalue [String] The username to be used to perform the bind
#
# @raise [JSS::InvalidDataError] If newvalue is not a String
#
# @return [void]
# @return [Void]
def username=(newvalue)
raise JSS::InvalidDataError, "Username must be a String" unless newvalue.is_a? String

Expand All @@ -188,7 +232,9 @@ def username=(newvalue)
#
# @author Tyler Morgan
#
# @param newvalue [Integer]
# @param newvalue [Integer] The priority this binding would have over other bindings that are installed
#
# @note The lower the number, the higher priority the binding has.
#
# @raise [JSS::InvalidDataError] If newvalue is not an Integer
# @raise [JSS::InvalidDataError] If newvalue is not between 1 and 10
Expand Down
9 changes: 8 additions & 1 deletion lib/jss/api_object/directory_binding_type.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
### Copyright 2019 Rixar
### Copyright 2019 Pixar

###
### Licensed under the Apache License, Version 2.0 (the "Apache License")
Expand Down Expand Up @@ -33,10 +33,17 @@ module DirectoryBindingType

# Module Methods
#####################################

# Let the object know it should update
# @return [Void]
def should_update
@need_to_update = true
end


# Set the type object for the specific settings for the provided JSS::DirectoryBinding
# @param settings [DirectoryBindingType] The settings object to be set for the specific JSS::DirectoryBinding object.
# @return [Void]
def set_type_settings(settings)
@type_settings = settings
@type_settings.container = self
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
### Copyright 2019 Rixar
### Copyright 2019 Pixar

###
### Licensed under the Apache License, Version 2.0 (the "Apache License")
Expand Down
39 changes: 35 additions & 4 deletions lib/jss/api_object/directory_binding_type/admitmac.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
### Copyright 2019 Rixar
### Copyright 2019 Pixar

###
### Licensed under the Apache License, Version 2.0 (the "Apache License")
Expand Down Expand Up @@ -76,21 +76,52 @@ class ADmitMac < DirectoryBindingType
# Attributes
#####################################

# @return [Boolean] Require confirmation before creating the account locally
attr_reader :require_confirmation

# @return [String] The path to the local home directory
attr_reader :local_home

# @return [Symbol] The mount style for the home directory
attr_reader :mount_style

# @return [String] The default shell to be used by the user
attr_reader :default_shell

# @return [Boolean] Mount the network home share locally
attr_reader :mount_network_home

# @return [String] The path the user's home folder(s) would be created in
attr_reader :place_home_folders

# @return [String] The UID to be mapped to the user
attr_reader :uid

# @return [String] The User's Group ID to be mapped to the user
attr_reader :user_gid

# @return [String] The Group ID to be mapped
attr_reader :gid
attr_reader :admin_group

# @return [Array<String>] The groups to be given admin rights upon logging in
attr_reader :admin_groups

# @return [Boolean] Cache credentials for authentication off network
attr_reader :cached_credentials

# @return [Boolean] Add the user as a local account
attr_reader :add_user_to_local

# @return [String] The OU path for the user
attr_reader :users_ou

# @return [String] The OU path for the group
attr_reader :groups_ou

# @return [String] The OU path for the printers
attr_reader :printers_ou

# @return [String] The OU path for the shared folders
attr_reader :shared_folders_ou

# Constructor
Expand Down Expand Up @@ -315,7 +346,7 @@ def gid=(newvalue)
# @raise [JSS::InvalidDataError] If the new value is not an Array
#
# @return [void]
def admin_group=(newvalue)
def admin_groups=(newvalue)

raise JSS::InvalidDataError, "An Array must be provided, please use add_admin_group and remove_admin_group for individual group additions and removals." unless newvalue.is_a? Array

Expand Down Expand Up @@ -472,7 +503,7 @@ def add_admin_group(value)
#
# @author Tyler Morgan
#
# @param newvalue [String] The admin group name you wish to remove from the admin group list
# @param value [String] The admin group name you wish to remove from the admin group list
#
# @raise [JSS::InvalidDataError] If the value provided is not a String
# @raise [JSS::InvalidDataError] If the group provided is not in the admin_group array
Expand Down
19 changes: 17 additions & 2 deletions lib/jss/api_object/directory_binding_type/centrify.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
### Copyright 2019 Rixar
### Copyright 2019 Pixar

###
### Licensed under the Apache License, Version 2.0 (the "Apache License")
Expand Down Expand Up @@ -60,10 +60,20 @@ class Centrify < DirectoryBindingType

# Attributes
#####################################

# @return [Boolean] If the Centrify workstation mode would be activated
attr_reader :workstation_mode

# @return [Boolean] Overwrite existing joined computer in the directory
attr_reader :overwrite_existing

# @return [Boolean] Update the PAM module and overwrite Directoryservice configuration
attr_reader :update_PAM

# @return [Boolean] The zone the computer will be joined to
attr_reader :zone

# @return [String] The preferred domain server
attr_reader :preferred_domain_server

# Constructor
Expand All @@ -75,7 +85,12 @@ class Centrify < DirectoryBindingType
# @see JSS::DirectoryBinding
# @see JSS::DirectoryBindingType
#
# @param [Hash] initialize data
# @param [Hash] init_data The options to create the Centrify object
# @option init_data [Boolean] :workstation_mode Will the Centrify workstation mode be activated
# @option init_data [Boolean] :overwrite_existing Overwrite existing joined computer in the directory
# @option init_data [Boolean] :update_PAM Update the PAM module and overwrite directory service configuration
# @option init_data [String] :zone The zone the computer will be joined to
# @option init_data [String] :preferred_domain_server The preferred domain server
def initialize(init_data)

# Return without processing anything since there is
Expand Down
13 changes: 9 additions & 4 deletions lib/jss/api_object/directory_binding_type/open_directory.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
### Copyright 2019 Rixar
### Copyright 2019 Pixar

###
### Licensed under the Apache License, Version 2.0 (the "Apache License")
Expand Down Expand Up @@ -41,9 +41,6 @@ module DirectoryBindingType
# Class for the specific OpenDirectory DirectoryBinding type stored within the JSS
#
# @author Tyler Morgan
#
# Attributes
# @!attribute [rw] require_confirmation

class OpenDirectory < DirectoryBindingType
# Mix-Ins
Expand All @@ -57,9 +54,17 @@ class OpenDirectory < DirectoryBindingType

# Attributes
#####################################

# @return [Boolean] Encrypt the connection using SSL
attr_reader :encrypt_using_ssl

# @return [Boolean] Attempt to perform a secure bind to the domain server
attr_reader :perform_secure_bind

# @return [Boolean] Use this domain server for authentication
attr_reader :use_for_authentication

# @return [Boolean] Use this domain server for contact population
attr_reader :use_for_contacts

# Constructor
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
### Copyright 2019 Rixar
### Copyright 2019 Pixar

###
### Licensed under the Apache License, Version 2.0 (the "Apache License")
Expand Down
9 changes: 8 additions & 1 deletion lib/jss/api_object/dock_item.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
### Copyright 2019 Rixar
### Copyright 2019 Pixar

###
### Licensed under the Apache License, Version 2.0 (the "Apache License")
Expand Down Expand Up @@ -76,9 +76,16 @@ class DockItem < JSS::APIObject

# Attributes
#####################################
# @return [Integer] The id of the dock item object
attr_reader :id

# @return [String] The name of the dock item object
attr_reader :name

# @return [String] The type of dock item object
attr_reader :type

# @return [String] The path for the specific icon
attr_reader :path

# Constructor
Expand Down