allows adding `protected=True` to a view_config`
972728
def protected_view(view, info):
    """"""

    if info.options.get('protected'):
        def wrapper_view(context, request):
            response = _advice(request)
            if response is not None:
                return response
            else:
                return view(context, request)
        return wrapper_view
    return view
635238
def add_subview(view_or_constant, opts={})
      subviews_added = []

      selected.each do |selected_view|
        created = false
        appended = false
        built = false

        if view_or_constant.is_a?(UIView)
          new_view = view_or_constant
        else
          created = true
          new_view = create_view(view_or_constant, opts)
        end

        rmq_data = new_view.rmq_data

        unless rmq_data.built
          rmq_data.built = true # build only once
          built = true
        end

        rmq_data.view_controller = self.weak_view_controller

        subviews_added << new_view

        unless opts[:do_not_add]
          if at_index = opts[:at_index]
            selected_view.insertSubview(new_view, atIndex: at_index)
          elsif below_view = opts[:below_view]
            selected_view.insertSubview(new_view, belowSubview: below_view)
          else
            selected_view.addSubview(new_view)
          end

          appended = true
        end

        if created
          new_view.rmq_created
        end
        new_view.rmq_build if built
        new_view.rmq_appended if appended

        if self.stylesheet
          apply_style_to_view(new_view, opts[:style]) if opts[:style]
        end
      end

      view = RMQ.create_with_array_and_selectors(subviews_added, selectors, @context, self)
      opts[:block].call view if opts[:block]
      opts[:raw_block].call view.get if opts[:raw_block]
      view
    end
1066396
function toggleDefaultExtension(path, enabled) {
        var arr = PreferencesManager.get(PREF_EXTENSIONS_DEFAULT_DISABLED);
        if (!Array.isArray(arr)) { arr = []; }
        var io = arr.indexOf(path);
        if (enabled === true && io !== -1) {
            arr.splice(io, 1);
        } else if (enabled === false && io === -1) {
            arr.push(path);
        }
        PreferencesManager.set(PREF_EXTENSIONS_DEFAULT_DISABLED, arr);
    }
241478
static function isKeepModeView( $module, $view )
    {
        $ini = eZINI::instance();
        $viewsModes  = $ini->variable( 'SSLZoneSettings', 'ModuleViewAccessMode' );
        $sslViews      = array_keys( $viewsModes, 'ssl' );
        $keepModeViews = array_keys( $viewsModes, 'keep' );

        if ( eZSSLZone::viewIsInArray( $module, $view, $keepModeViews ) <
             eZSSLZone::viewIsInArray( $module, $view, $sslViews ) )
        {
            eZDebugSetting::writeDebug( 'kernel-ssl-zone', 'The view cannot choose access mode itself.' );
            return false;
        }

        return true;
    }
42086
public static void toggleVisibility(View view, int hidingPolicy) {
        int current = view.getVisibility();
        view.setVisibility(current == View.VISIBLE ? hidingPolicy : View.VISIBLE);
    }
451984
private void checkAndEnableViewButton() {
		boolean enabled = true;
		enabled &= Desktop.isDesktopSupported();
		enabled &= txt_PubCert.getDocument().getLength() > MIN_CERT_LENGTH;
		bt_view.setEnabled(enabled);
	}
812471
function abortControlsAutoHide( viewer ) {
    var i;
    viewer.controlsShouldFade = false;
    for ( i = viewer.controls.length - 1; i >= 0; i-- ) {
        viewer.controls[ i ].setOpacity( 1.0 );
    }
}
946505
function _defaultEnabled(env, addonConfig) {
  let usingInDev = env === 'development' && !addonConfig.usingProxy;
  let usingInTest = env === 'test';

  return usingInDev || usingInTest;
}
95271
def auth_required(self, view):
        

        @functools.wraps(view)
        def decorated(*args, **kwargs):
            log.info("Trying to get access to protected resource: '%s'", view.__name__)
            if request.method == 'POST':
                token = request.form['token']
                if self.development or self.authenticated(token):
                    return view(*args, **kwargs)
                else:
                    log.warning("User has not been authorized to get access to resource: %s", view.__name__)
            else:
                log.warning("Bad request type! Expected 'POST', actual '%s'", request.method)

            return abort(403)

        return decorated
576984
def protect(view):
    

    @wraps(view)
    def csrf_check(*args, **kwargs):
        # an empty form is used to validate current csrf token and only that!
        if not FlaskForm().validate():
            raise Forbidden("CSRF validation failed.")

        return view(*args, **kwargs)

    return csrf_check
478944
private void doSecurityManager() throws PageException {
	String rtnVar = getString("admin", action, "returnVariable");
	String secType = getString("admin", action, "sectype");
	String secValue = getString("secvalue", null);
	boolean isServer = config instanceof ConfigServer;

	if (secValue == null) {
	    if (isServer) {
		pageContext.setVariable(rtnVar, SecurityManagerImpl.toStringAccessValue(SecurityManager.VALUE_YES));
	    }
	    else {
		pageContext.setVariable(rtnVar, SecurityManagerImpl.toStringAccessValue(config.getSecurityManager().getAccess(secType)));
	    }
	    return;
	}
	pageContext.setVariable(rtnVar, Caster.toBoolean(isServer || config.getSecurityManager().getAccess(secType) == SecurityManagerImpl.toShortAccessValue(secValue)));
    }
1051426
function updateProtectedValuesSalt(node, protectSaltGenerator) {
    traverse(node, function(node) {
        if (strToBoolean(node.getAttribute(XmlNames.Attr.Protected)) && node.protectedValue) {
            var newSalt = protectSaltGenerator.getSalt(node.protectedValue.byteLength);
            node.protectedValue.setSalt(newSalt);
            node.textContent = node.protectedValue.toString();
        }
    });
}
688975
function(view, config) {
  var formInputs = getForm(view);

  formInputs = _.reject(formInputs, function(el) {
    var reject;
    var myType = getElementType(el);
    var extractor = config.keyExtractors.get(myType);
    var identifier = extractor($(el));

    var foundInIgnored = _.find(config.ignoredTypes, function(ignoredTypeOrSelector) {
      return (ignoredTypeOrSelector === myType) || $(el).is(ignoredTypeOrSelector);
    });

    var foundInInclude = _.includes(config.include, identifier);
    var foundInExclude = _.includes(config.exclude, identifier);

    if (foundInInclude) {
      reject = false;
    } else {
      if (config.include) {
        reject = true;
      } else {
        reject = (foundInExclude || foundInIgnored);
      }
    }

    return reject;
  });

  return formInputs;
}
1207585
function(role, view, template_arguments) {

		var result = false;

		if (role in this._role_handlers) {

			this[this._role_handlers[role]](view, template_arguments);
			result = true;

		}

		return result;

	}
357931
def validate_value(config, allowed_values)
      value = instance_variable_get("@#{config}")

      return unless invalid_value?(value, allowed_values)

      message = "Configuration value `#{value}` is not allowed for `#{config}`."
      raise ConfigurationError, message
    end
1248845
def set_enable_flag_keep_rect_within_constraints(self, enable):
        
        for child_state_v in self.child_state_views():
            self.keep_rect_constraints[child_state_v].enable = enable
            child_state_v.keep_rect_constraints[child_state_v._name_view].enable = enable
514449
function(view_config, id) {

		if (Lava.schema.DEBUG && !Lava.isValidId(id)) Lava.t();
		view_config.id = id;

	}