Restrict perspective access base on IP

I would like to enable/disable control (ex. a button) based on client IP address. How would I accomplish this?

The best way I can think of is a little complicated, but it works.

  1. Create a Security Zone based on the IP ranges you want to ALLOW (I’ll call mine “VALIDIP”).
  2. Create a Security Level (I’ll call mine “valid_ip”).
  3. Modify the Security Level Rules within your Identity Provider, and use the expression language with the following expression (straight from the example in the documentation): containsAny({security-zones}, 'VALIDIP')
  4. You now have three options:
    A: You can modify the security settings of the button to disable it if the security level required is not met.
    B. You can bind the visibility of the button to an expression which uses the security level (not very secure, but nice for removing buttons a user shouldn’t click.
    C. Do both A and B.