From 4a1d4025073d732174ce128f2bb67cf7ef29bde3 Mon Sep 17 00:00:00 2001 From: Tyler Morgan Date: Wed, 2 Sep 2020 16:51:39 -0400 Subject: [PATCH 1/4] Adding more commenting --- lib/jss/api_object/directory_binding.rb | 77 ++++++++++++++++++++----- 1 file changed, 61 insertions(+), 16 deletions(-) diff --git a/lib/jss/api_object/directory_binding.rb b/lib/jss/api_object/directory_binding.rb index 4ac442b9..6cd56403 100644 --- a/lib/jss/api_object/directory_binding.rb +++ b/lib/jss/api_object/directory_binding.rb @@ -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", @@ -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 @@ -89,23 +91,58 @@ 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 + 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 @@ -145,20 +182,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 @@ -171,11 +214,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 @@ -188,7 +231,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 From 86a3ad1376b041bf58e0c89b49114660df282145 Mon Sep 17 00:00:00 2001 From: Tyler Morgan Date: Wed, 2 Sep 2020 16:55:36 -0400 Subject: [PATCH 2/4] Final comments for the day --- lib/jss/api_object/directory_binding_type.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/jss/api_object/directory_binding_type.rb b/lib/jss/api_object/directory_binding_type.rb index ce6fca7a..c672ba53 100644 --- a/lib/jss/api_object/directory_binding_type.rb +++ b/lib/jss/api_object/directory_binding_type.rb @@ -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 From 8a138caacdc5f83364e60f8c4d73ecccc727357e Mon Sep 17 00:00:00 2001 From: Tyler Morgan Date: Thu, 3 Sep 2020 10:18:23 -0400 Subject: [PATCH 3/4] Adding better commenting --- lib/jss/api_object/directory_binding.rb | 3 +- lib/jss/api_object/directory_binding_type.rb | 2 +- .../active_directory.rb | 2 +- .../directory_binding_type/admitmac.rb | 39 +++++++++++++++++-- .../directory_binding_type/centrify.rb | 19 ++++++++- .../directory_binding_type/open_directory.rb | 13 +++++-- .../powerbroker_identity_services.rb | 2 +- lib/jss/api_object/dock_item.rb | 2 +- 8 files changed, 67 insertions(+), 15 deletions(-) diff --git a/lib/jss/api_object/directory_binding.rb b/lib/jss/api_object/directory_binding.rb index 6cd56403..41de586a 100644 --- a/lib/jss/api_object/directory_binding.rb +++ b/lib/jss/api_object/directory_binding.rb @@ -1,4 +1,4 @@ -### Copyright 2019 Rixar +### Copyright 2019 Pixar ### ### Licensed under the Apache License, Version 2.0 (the "Apache License") @@ -113,6 +113,7 @@ class DirectoryBinding < JSS::APIObject # @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. diff --git a/lib/jss/api_object/directory_binding_type.rb b/lib/jss/api_object/directory_binding_type.rb index c672ba53..95d4fdce 100644 --- a/lib/jss/api_object/directory_binding_type.rb +++ b/lib/jss/api_object/directory_binding_type.rb @@ -1,4 +1,4 @@ -### Copyright 2019 Rixar +### Copyright 2019 Pixar ### ### Licensed under the Apache License, Version 2.0 (the "Apache License") diff --git a/lib/jss/api_object/directory_binding_type/active_directory.rb b/lib/jss/api_object/directory_binding_type/active_directory.rb index 67cb1d8f..181a74a0 100644 --- a/lib/jss/api_object/directory_binding_type/active_directory.rb +++ b/lib/jss/api_object/directory_binding_type/active_directory.rb @@ -1,4 +1,4 @@ -### Copyright 2019 Rixar +### Copyright 2019 Pixar ### ### Licensed under the Apache License, Version 2.0 (the "Apache License") diff --git a/lib/jss/api_object/directory_binding_type/admitmac.rb b/lib/jss/api_object/directory_binding_type/admitmac.rb index 3c0ec9ba..bbfab08f 100644 --- a/lib/jss/api_object/directory_binding_type/admitmac.rb +++ b/lib/jss/api_object/directory_binding_type/admitmac.rb @@ -1,4 +1,4 @@ -### Copyright 2019 Rixar +### Copyright 2019 Pixar ### ### Licensed under the Apache License, Version 2.0 (the "Apache License") @@ -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] 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 @@ -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 @@ -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 diff --git a/lib/jss/api_object/directory_binding_type/centrify.rb b/lib/jss/api_object/directory_binding_type/centrify.rb index 0a8d2621..c6ac73ef 100644 --- a/lib/jss/api_object/directory_binding_type/centrify.rb +++ b/lib/jss/api_object/directory_binding_type/centrify.rb @@ -1,4 +1,4 @@ -### Copyright 2019 Rixar +### Copyright 2019 Pixar ### ### Licensed under the Apache License, Version 2.0 (the "Apache License") @@ -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 @@ -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 diff --git a/lib/jss/api_object/directory_binding_type/open_directory.rb b/lib/jss/api_object/directory_binding_type/open_directory.rb index e0ee5caa..4f9e6ac1 100644 --- a/lib/jss/api_object/directory_binding_type/open_directory.rb +++ b/lib/jss/api_object/directory_binding_type/open_directory.rb @@ -1,4 +1,4 @@ -### Copyright 2019 Rixar +### Copyright 2019 Pixar ### ### Licensed under the Apache License, Version 2.0 (the "Apache License") @@ -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 @@ -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 diff --git a/lib/jss/api_object/directory_binding_type/powerbroker_identity_services.rb b/lib/jss/api_object/directory_binding_type/powerbroker_identity_services.rb index ccbfa71e..8a61df05 100644 --- a/lib/jss/api_object/directory_binding_type/powerbroker_identity_services.rb +++ b/lib/jss/api_object/directory_binding_type/powerbroker_identity_services.rb @@ -1,4 +1,4 @@ -### Copyright 2019 Rixar +### Copyright 2019 Pixar ### ### Licensed under the Apache License, Version 2.0 (the "Apache License") diff --git a/lib/jss/api_object/dock_item.rb b/lib/jss/api_object/dock_item.rb index 8fbae48c..1a65590b 100644 --- a/lib/jss/api_object/dock_item.rb +++ b/lib/jss/api_object/dock_item.rb @@ -1,4 +1,4 @@ -### Copyright 2019 Rixar +### Copyright 2019 Pixar ### ### Licensed under the Apache License, Version 2.0 (the "Apache License") From f8e1dcb444470b8f66dcd13774f8d4cc33a5ee5a Mon Sep 17 00:00:00 2001 From: Tyler Morgan Date: Thu, 3 Sep 2020 10:20:51 -0400 Subject: [PATCH 4/4] Added better commenting --- lib/jss/api_object/dock_item.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/jss/api_object/dock_item.rb b/lib/jss/api_object/dock_item.rb index 1a65590b..07e77b77 100644 --- a/lib/jss/api_object/dock_item.rb +++ b/lib/jss/api_object/dock_item.rb @@ -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