<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>You can reuse the grp database table (from the group module) but
      do the query you need using sql_query() (from sqlops) module. So
      you don't have to use the functions of the group module if they do
      not fit your needs, anyhow behind is_user_in() is an sql  query.</p>
    <p>If you authenticate the user with password before this check, you
      can extend subscriber table with another column where you store
      the permissions address group and the value can be loaded using
      load_credentials parameter of auth_db module.</p>
    <p>Cheers,<br>
      Daniel<br>
    </p>
    <div class="moz-cite-prefix">On 07.11.19 11:08, Igor Olhovskiy
      wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:D660DD3A-39C3-45CB-BE11-B0FFBC1F4D4F@getmailspring.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div>Thanks! </div>
      <br>
      <div>Looks ok. (Despite the fact it's looking like write-only
        statement : ) </div>
      <div>Idea was, that I want to avoid creating additional tables or
        schema of ACL. Means if I can use already built-in
        mechanism/tables/schema - than why to implement own. Code reuse,
        all this.</div>
      <br>
      <div class="gmail_quote_attribution">On Nov 7 2019, at 10:56 am,
        Daniel Tryba <a class="moz-txt-link-rfc2396E" href="mailto:d.tryba@pocos.nl"><d.tryba@pocos.nl></a> wrote:</div>
      <blockquote>
        <div>
          <div>On Wed, Nov 06, 2019 at 07:15:42PM +0100, Igor Olhovskiy
            wrote:</div>
          <blockquote><br>
            <div>Hm... Maybe there is other module to achieve such
              functions?</div>
            <div>Best if it would be with cache :)</div>
            <div>But if no - regex also fine.</div>
          </blockquote>
          <br>
          <div>But if it works it works! I don't think there is a
            specific module to do</div>
          <div>this but it is easy to implement yourself. What I don't
            like personally</div>
          <div>about your solution is the use of the permission tables,
            you need</div>
          <div>atleast 1 per user (unless users have the same ip).</div>
          <br>
          <div>Personally I do this by direct database queries in
            usr_preferences on</div>
          <div>INVITEs and REGISTERs. You could use any database
            (depending on how you</div>
          <div>store the ACL) and cache it in a htable.</div>
          <br>
          <div>My solution is mysql specific (inet_aton) and forces
            users to have</div>
          <div>atleast 1 CIDR notated subnet:</div>
          <br>
          <div>if(!avp_db_query("select value from usr_preferences where
            username='$au' and attribute='acl' and</div>
          <div>inet_aton(substring_index(value,'/',1))&(1 <<
            32) - 1 & ~((1 << (32 -</div>
          <div>substring_index(value,'/',-1))) -
            1)=inet_aton('$si')&(1 << 32) -</div>
          <div>1 & ~((1 << (32 -
            substring_index(value,'/',-1))) - 1)"))</div>
          <div>{</div>
          <div>t_reply("404","Go away");</div>
          <div>exit;</div>
          <div>}</div>
          <br>
          <div>_______________________________________________</div>
          <div>Kamailio (SER) - Users Mailing List</div>
          <div><a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.kamailio.org">sr-users@lists.kamailio.org</a></div>
          <div><a class="moz-txt-link-freetext" href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a></div>
        </div>
      </blockquote>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
Kamailio (SER) - Users Mailing List
<a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.kamailio.org">sr-users@lists.kamailio.org</a>
<a class="moz-txt-link-freetext" href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
    </blockquote>
    <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla -- <a class="moz-txt-link-abbreviated" href="http://www.asipto.com">www.asipto.com</a>
<a class="moz-txt-link-abbreviated" href="http://www.twitter.com/miconda">www.twitter.com/miconda</a> -- <a class="moz-txt-link-abbreviated" href="http://www.linkedin.com/in/miconda">www.linkedin.com/in/miconda</a>
Kamailio World Conference - April 27-29, 2020, in Berlin -- <a class="moz-txt-link-abbreviated" href="http://www.kamailioworld.com">www.kamailioworld.com</a></pre>
  </body>
</html>