lib/open_directory_utils/commands_user_attribs.rb
def user_set_primary_group_id(attribs, dir_info)
      attribs = user_record_name_alternatives(attribs)

      attribs[:value] = attribs[:value] || attribs[:groupid]
      attribs[:value] = attribs[:value] || attribs[:group_id]
      attribs[:value] = attribs[:value] || attribs[:gidnumber]
      attribs[:value] = attribs[:value] || attribs[:groupnumber]
      attribs[:value] = attribs[:value] || attribs[:group_number]
      attribs[:value] = attribs[:value] || attribs[:primarygroupid]
      attribs[:value] = attribs[:value] || attribs[:primary_group_id]

      check_critical_attribute( attribs, :record_name )
      check_critical_attribute( attribs, :value, :group_id )
      attribs    = tidy_attribs(attribs)

      command    = {action: 'create', scope: 'Users', attribute: 'PrimaryGroupID'}
      user_attrs = attribs.merge(command)

      answer = dscl( user_attrs, dir_info )
      attribs[:value] = nil
      return answer
    end
# sudo dscl . -create /Users/someuser PrimaryGroupID 80
sudo dscl . -create /Users/someuser PrimaryGroupID 80
sudo dscl . - create / Users / someuser PrimaryGroupID 80
def user_set_primary_group_id(attribs, dir_info)
      attribs = user_record_name_alternatives(attribs)
      attribs[:value] = attribs[:value] || attribs[:groupid]
      attribs[:value] = attribs[:value] || attribs[:group_id]
      attribs[:value] = attribs[:value] || attribs[:gidnumber]
      attribs[:value] = attribs[:value] || attribs[:groupnumber]
      attribs[:value] = attribs[:value] || attribs[:group_number]
      attribs[:value] = attribs[:value] || attribs[:primarygroupid]
      attribs[:value] = attribs[:value] || attribs[:primary_group_id]
      check_critical_attribute( attribs, :record_name )
      check_critical_attribute( attribs, :value, :group_id )
      attribs    = tidy_attribs(attribs)
      command    = {action: 'create', scope: 'Users', attribute: 'PrimaryGroupID'}
      user_attrs = attribs.merge(command)
      answer = dscl( user_attrs, dir_info )
      attribs[:value] = nil
      return answer
    end
def user_set_primary_group_id ( attribs , dir_info ) attribs = user_record_name_alternatives ( attribs ) attribs [ :value ] = attribs [ :value ] || attribs [ :groupid ] attribs [ :value ] = attribs [ :value ] || attribs [ :group_id ] attribs [ :value ] = attribs [ :value ] || attribs [ :gidnumber ] attribs [ :value ] = attribs [ :value ] || attribs [ :groupnumber ] attribs [ :value ] = attribs [ :value ] || attribs [ :group_number ] attribs [ :value ] = attribs [ :value ] || attribs [ :primarygroupid ] attribs [ :value ] = attribs [ :value ] || attribs [ :primary_group_id ] check_critical_attribute ( attribs , :record_name ) check_critical_attribute ( attribs , :value , :group_id ) attribs = tidy_attribs ( attribs ) command = { action : 'create' , scope : 'Users' , attribute : 'PrimaryGroupID' } user_attrs = attribs . merge ( command ) answer = dscl ( user_attrs , dir_info ) attribs [ :value ] = nil return answer end
sudo dscl .
sudo dscl .
attribs
dir_info