Process to lock a user in the Equitrac System

 @param attr [Hash] this attribute MUST include: { user_id: "userid" }
 @return [String] Formatted for EQCmd.exe command execution
161079
def user_modify(attribs)
      defaults = {user_name: "!", min_bal: "!",
                  email: "!", dept_name: "!", pimary_pin: "!",
                  secondary_pin: "!", quota: "!", alternate_pin: "!",
                  home_server: "!", locked: "!", location: "!",
                  default_bc: "!", additional_info: "!", home_folder: "!"}
      attribs = defaults.merge(attribs)
      attribs = check_atrribs(attribs)
      "modify ur #{attribs[:user_id]} \"#{attribs[:user_name]}\"" +
      " #{attribs[:min_bal]} #{attribs[:email]} #{attribs[:dept_name]}" +
      " #{attribs[:primary_pin]} #{attribs[:secondary_pin]}" +
      " #{attribs[:quota]} #{attribs[:alternate_pin]}" +
      " #{attribs[:home_server]} #{attribs[:locked]}" +
      " #{attribs[:location]} #{attribs[:default_bc]}" +
      " #{attribs[:additional_info]} #{attribs[:home_folder]}"
    end
212397
private void validateDeleteAllowed(Attribute attr) {
    String attrIdentifier = attr.getIdentifier();
    if (systemEntityTypeRegistry.hasSystemAttribute(attrIdentifier)) {
      throw new SystemMetadataModificationException();
    }
  }
934320
def method_missing(name, *args, &block)
      return attr(name[0..-2], args[0]) if args.size == 1 and name[-1] == '='
    end
847926
def evaluated_attr_encrypted_options_for(attribute)
        evaluated_options = Hash.new
        attributes = encrypted_attributes[attribute.to_sym]
        attribute_option_value = attributes[:attribute]

        [:if, :unless, :value_present, :allow_empty_value].each do |option|
          evaluated_options[option] = evaluate_attr_encrypted_option(attributes[option])
        end

        evaluated_options[:attribute] = attribute_option_value

        evaluated_options.tap do |options|
          if options[:if] && !options[:unless] && options[:value_present] || options[:allow_empty_value]
            (attributes.keys - evaluated_options.keys).each do |option|
              options[option] = evaluate_attr_encrypted_option(attributes[option])
            end

            unless options[:mode] == :single_iv_and_salt
              load_iv_for_attribute(attribute, options)
            end

            if options[:mode] == :per_attribute_iv_and_salt
              load_salt_for_attribute(attribute, options)
            end
          end
        end
      end
1218493
def parse_connect_attrs(conn_attrs)
      return {} if Mysql2::Client::CONNECT_ATTRS.zero?
      conn_attrs ||= {}
      conn_attrs[:program_name] ||= $PROGRAM_NAME
      conn_attrs.each_with_object({}) do |(key, value), hash|
        hash[key.to_s] = value.to_s
      end
    end
1330753
def obligation (attr_validator, hash_or_attr = nil, path = [])
      hash_or_attr ||= @attr_hash
      case hash_or_attr
      when Symbol
        @context ||= begin
          rule_model = attr_validator.context.to_s.classify.constantize
          context_reflection = self.class.reflection_for_path(rule_model, path + [hash_or_attr])
          if context_reflection.klass.respond_to?(:decl_auth_context)
            context_reflection.klass.decl_auth_context
          else
            context_reflection.klass.name.tableize.to_sym
          end
        rescue # missing model, reflections
          hash_or_attr.to_s.pluralize.to_sym
        end
        
        obligations = attr_validator.engine.obligations(@privilege,
                          :context => @context,
                          :user    => attr_validator.user)

        obligations.collect {|obl| {hash_or_attr => obl} }
      when Hash
        obligations_array_attrs = []
        obligations =
            hash_or_attr.inject({}) do |all, pair|
              attr, sub_hash = pair
              all[attr] = obligation(attr_validator, sub_hash, path + [attr])
              if all[attr].length > 1
                obligations_array_attrs << attr
              else
                all[attr] = all[attr].first
              end
              all
            end
        obligations = [obligations]
        obligations_array_attrs.each do |attr|
          next_array_size = obligations.first[attr].length
          obligations = obligations.collect do |obls|
            (0...next_array_size).collect do |idx|
              obls_wo_array = obls.clone
              obls_wo_array[attr] = obls_wo_array[attr][idx]
              obls_wo_array
            end
          end.flatten
        end
        obligations
      when NilClass
        attr_validator.engine.obligations(@privilege,
            :context => attr_validator.context,
            :user    => attr_validator.user)
      else
        raise AuthorizationError, "Wrong conditions hash format: #{hash_or_attr.inspect}"
      end
    end
1131118
static function input_attr(&$attr)
	{
	    $str = " ";
        if(!empty($attr) && is_array($attr))
        {
            foreach($attr as $key=>$value)
            {
                $str .= "$key=\"$value\" ";
            }
        }
        return $str;
	}
1348586
def random_uniq_attr(field, **options, &block)
      set_method = :"set_#{field}"
      generate_method = :"generate_#{field}"
      max_attempts = options.fetch(:max_attempts) { MAX_ATTEMPTS }

      after_create set_method, unless: :"#{field}?"

      # def self.generate_key
      define_singleton_method generate_method, &(block || DEFAULT_GENERATOR)

      # def set_key
      define_method(set_method) do
        attempt = 0
        begin
          raise 'Available only for persisted record' unless persisted?
          transaction(requires_new: true) do
            new_value = self.class.send(generate_method, self)
            update_column field, new_value # rubocop:disable Rails/SkipsModelValidations
          end
        rescue ActiveRecord::RecordNotUnique
          attempt += 1
          raise if attempt > max_attempts
          retry
        end
      end
    end
754371
def attrs
      atrs = {
        :object_type => "object-type-#{obj_type}", :permission_id => 'manage',
        :name => name, :field_type => 'text', :is_required => false,
        :is_primary => true
      }

      if !id.nil?
        atrs.merge!(:field_id => id)
      end

      atrs
    end
742825
def attr_name(model, attr, suffix: nil)
      klass = model.is_a?(Class) ? model : model.class
      klass.human_attribute_name(attr) + String(suffix)
    end
613712
def instance_get(attribute)
      getter = :"#{self.name}_#{attribute}"
      self.instance.send(getter) if instance.respond_to?(getter)
    end
1232785
function attribute( $attr )
    {
        switch ( $attr )
        {
            case "original_filename":
                return $this->OriginalFilename;
            case "mime_type":
                return $this->Type;
            case "mime_type_category":
                return $this->MimeCategory;
            case "mime_type_part":
                return $this->MimePart;
            case "filename":
                return $this->Filename;
            case "filesize":
                return $this->Size;
            case "is_temporary":
                return $this->IsTemporary;
            default:
            {
                eZDebug::writeError( "Attribute '$attr' does not exist", __METHOD__ );
                return null;
            } break;
        }
    }
57639
def raise_on_duplicate(self, attrname):
        
        if getattr(self, attrname):
            with transaction.atomic():
                error_msg = (
                    'Cannot {{action}} registered subject with a duplicate '
                    '\'{}\'. Got {}.'.format(attrname, getattr(self, attrname)))
                try:
                    obj = self.__class__.objects.exclude(
                        **{'pk': self.pk} if self.id else {}).get(
                            **{attrname: getattr(self, attrname)})
                    if not self.id:
                        raise RegisteredSubjectError(
                            error_msg.format(action='insert'))
                    elif self.subject_identifier_is_set() and obj.id != self.id:
                        raise RegisteredSubjectError(
                            error_msg.format(action='update'))
                    else:
                        raise RegisteredSubjectError(
                            error_msg.format(action='update'))
                except self.__class__.DoesNotExist:
                    pass
467279
def read_encrypted_attribute(to_attr_name, cipher_class, options)
        value = read_attribute(to_attr_name)
        
        # Make sure we set the cipher for equality comparison when reading
        # from the database. This should only be done if the value is *not*
        # blank, is *not* encrypted, and hasn't changed since it was read from
        # the database. The dirty checking is important when the encypted value
        # is written to the same attribute as the unencrypted value (i.e. you
        # don't want to encrypt when a new value has been set)
        unless value.blank? || value.encrypted? || attribute_changed?(to_attr_name)
          # Create the cipher configured for this attribute
          value.cipher = create_cipher(cipher_class, options, value)
        end
        
        value
      end
316917
def attribute?(attr)
      return false unless container.key?(key_as_sym(attr))
      ![ "", " ", nil, [],[""], [" "], self.class.new({}), [[]]].any? {|a| a == container[key_as_sym(attr)] }
    end
884189
def method_missing(name, *args)
      attr = name.to_s.sub("=", "")
      return super unless attributes.has_key?(attr)
      if name.to_s.ends_with?("=")
        write_attribute(attr, *args)
      else
        read_attribute(attr)
      end
    end
677108
function attribute( $attr )
    {
        if ( $attr == "post" )
            return $_POST;
        if ( $attr == "get" )
            return $_GET;
        if ( $attr == "session" )
        {
            return eZSession::get();
        }
        $retValue = null;
        return $retValue;
    }