Skip to content

Conversation

@linvinus
Copy link

improvement: add support for IP based macro
i.e.
{{page>faq:@IP_10.10.8.0/24@}}
will include page faq:10.10.8.0_24 if client ip address is in network 10.10.8.0/24

{{page>faq:@IP_10.0.0.0/8@}}
will include page faq:10.0.0.0_8 if client ip address is in network 10.0.0.0/8

i.e.
{{page>faq:@IP_10.10.8.0/24@}}
will include page faq:10.10.8.0_24 if client ip addres is in network 10.10.8.0/24

{{page>faq:@IP_10.0.0.0/8@}}
will include page faq:10.0.0.0_8 if client ip addres is in network 10.0.0.0/8
@michitux
Copy link
Member

I think that in general this is a good feature, but I'm not too convinced that this is the right implementation. Note that when the macro is not replaced, the plugin will still clean the id and include the page that is specified if it exists, in your example faq:ip_10.10.8.0_24, i.e. the difference is the ip_-prefix.

A possibility to get the same feature without any modification is to use something like the ipgroup plugin and give users groups depending on their ip address. Then you can either use ACLs to restrict access to these pages or the group macro if the group is assigned as first group.

I'm also a bit undecided. On the one hand I can see that this is exactly the kind of feature that is nice to have. However, not only with ip, but also with user group for example (i.e. include this page if the user is in a certain group). So maybe this could be added as a flag. On the other hand I'm wondering if this is really still in the scope of the include plugin and not more a feature for a plugin like the variants plugin (that doesn't support this yet, but where this would perfectly fit). A possibility could also be to make it easier for plugins to include certain pages using the include plugin (as it is already done by the blog plugin) and to release such features as separate plugins.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants