You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@isis.apache.org by Fabio Purcino <fa...@viacodigo.com.br> on 2016/06/29 21:11:42 UTC

Security Module Addon Tables

Dear sirs,

I'm currently developing a solution using Apache Isis. I have implemented
Security Module Addon "out-of-box" according to Dan's video tutorial.

I'm persisting all data on a SQL Server Database but none of Security's
module tables are being created.

Is there any additional configuration?

Thanks,

-- 
------------------------------------------------------------
Fábio Purcino Aragão

Re: Security Module Addon Tables

Posted by Dan Haywood <da...@haywood-associates.co.uk>.
@Timothy,
thanks for this useful info... I'll add it to the docs.

@Fabio,
apologies not to get back to you before now. I'm not certain if you want to
move the security addon tables to a different schema, or whether simply the
schema that they live isn't being created on SQL Server?

My recollection is a bit hazy, I recall seeing different behaviour on
different DBs.  However, I just checked by running the security addon demo
app configured against SQL Server, and it did automatically create both the
schema and the tables, see [1]

To get this behaviour I just checked out from current master [2], then
edited the webapp/pom.xml to include the sqljdbc4 driver, and edited the
JDBC properties in persistor.properties:

isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionDriverName=com.microsoft.sqlserver.jdbc.SQLServerDriver
isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionURL=jdbc:sqlserver://127.0.0.1:1433;instance=.;databaseName=securitydemo
isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionUserName=securitydemo
isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionPassword=pass


This behaviour is because of these settings in
persistor_datanucleus.properties:

isis.persistor.datanucleus.impl.datanucleus.schema.autoCreateAll=true
isis.persistor.datanucleus.impl.datanucleus.schema.validateTables=true
isis.persistor.datanucleus.impl.datanucleus.schema.validateConstraints=true


It worked fine, as I say,  (Before I ran the app, that database was empty).



HTH
Dan


[1] http://imgur.com/i27Xl8j
[2] b1fdaccf04231a6c91a3774a90b99c7b314cd0ae to be exact




On 5 July 2016 at 01:03, Simecsek Timothy <Ti...@nttdata.com>
wrote:

> Hi Fabio,
>
> All Isis Modules are using their own schema since Apache ISIS 1.9 - have
> you checked if there are other schemas?
>
> If you want to avoid that and generate the tables for security module in a
> specific schema I found the only working solution is with package.jdo in
> META-INF directory, but you need to specify all queries, here the excerpt
> for security module of mine package.jdo file:
> <?xml version="1.0" encoding="UTF-8" ?>
> <jdo xmlns="http://xmlns.jcp.org/xml/ns/jdo/jdo"
>      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>      xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/jdo/jdo
>         http://xmlns.jcp.org/xml/ns/jdo/jdo_3_0.xsd" version="3.0">
>
>     <!-- Security Addon -->
>     <package name="org.isisaddons.module.security.dom.user">
>         <class name="ApplicationUser"
>                schema="a1ff"
>                table="IsisSecurityApplicationUser">
>             <query name="findByUsername" language="JDOQL">
>                 SELECT FROM
> org.isisaddons.module.security.dom.user.ApplicationUser WHERE username ==
> :username
>             </query>
>             <query name="findByEmailAddress" language="JDOQL">
>                 SELECT FROM
> org.isisaddons.module.security.dom.user.ApplicationUser WHERE emailAddress
> == :emailAddress
>             </query>
>             <query name="findByName" language="JDOQL">
>                 SELECT FROM
> org.isisaddons.module.security.dom.user.ApplicationUser WHERE
> username.matches(:nameRegex)   || familyName.matches(:nameRegex)   ||
> givenName.matches(:nameRegex)   || knownAs.matches(:nameRegex)
>             </query>
>             <query name="find" language="JDOQL">
>                 SELECT FROM
> org.isisaddons.module.security.dom.user.ApplicationUser WHERE
> username.matches(:regex) || familyName.matches(:regex) ||
> givenName.matches(:regex) || knownAs.matches(:regex) ||
> emailAddress.matches(:regex)
>             </query>
>         </class>
>     </package>
>     <package name="org.isisaddons.module.security.dom.tenancy">
>         <class name="ApplicationTenancy"
>                schema="a1ff"
>                table="IsisSecurityApplicationTenancy">
>             <query name="findByPath" language="JDOQL">
>                 SELECT FROM
> org.isisaddons.module.security.dom.tenancy.ApplicationTenancy WHERE path ==
> :path
>             </query>
>             <query name="findByName" language="JDOQL">
>                 SELECT FROM
> org.isisaddons.module.security.dom.tenancy.ApplicationTenancy WHERE name ==
> :name
>             </query>
>             <query name="findByNameOrPathMatching" language="JDOQL">
>                 SELECT FROM
> org.isisaddons.module.security.dom.tenancy.ApplicationTenancy WHERE
> name.matches(:regex) || path.matches(:regex)
>             </query>
>         </class>
>     </package>
>     <package name="org.isisaddons.module.security.dom.permission">
>         <class name="ApplicationPermission"
>                schema="a1ff"
>                table="IsisSecurityApplicationPermission">
>             <query name="findByRole" language="JDOQL">
>                 SELECT FROM
> org.isisaddons.module.security.dom.permission.ApplicationPermission WHERE
> role == :role
>             </query>
>             <query name="findByUser" language="JDOQL">
>                 SELECT FROM
> org.isisaddons.module.security.dom.permission.ApplicationPermission WHERE
> (u.roles.contains(role) &amp;&amp; u.username == :username) VARIABLES
> org.isisaddons.module.security.dom.user.ApplicationUser u
>             </query>
>             <query name="findByFeature" language="JDOQL">
>                 SELECT FROM
> org.isisaddons.module.security.dom.permission.ApplicationPermission WHERE
> featureType == :featureType    &amp;&amp; featureFqn == :featureFqn
>             </query>
>             <query name="findByRoleAndRuleAndFeature" language="JDOQL">
>                 SELECT FROM
> org.isisaddons.module.security.dom.permission.ApplicationPermission WHERE
> role == :role    &amp;&amp; rule == :rule    &amp;&amp; featureType ==
> :featureType    &amp;&amp; featureFqn == :featureFqn
>             </query>
>             <query name="findByRoleAndRuleAndFeatureType" language="JDOQL">
>                 SELECT FROM
> org.isisaddons.module.security.dom.permission.ApplicationPermission WHERE
> role == :role    &amp;&amp; rule == :rule    &amp;&amp; featureType ==
> :featureType
>             </query>
>         </class>
>     </package>
>     <package name="org.isisaddons.module.security.dom.role">
>         <class name="ApplicationRole"
>                schema="a1ff"
>                table="IsisSecurityApplicationRole">
>             <query name="findByName" language="JDOQL">
>                 SELECT FROM
> org.isisaddons.module.security.dom.role.ApplicationRole WHERE name == :name
>             </query>
>             <query name="findByNameContaining" language="JDOQL">
>                 SELECT FROM
> org.isisaddons.module.security.dom.role.ApplicationRole WHERE
> name.matches(:nameRegex)
>             </query>
>         </class>
>     </package>
>
> Regards Timothy
>
> -----Ursprüngliche Nachricht-----
> Von: Fabio Purcino [mailto:fabio@viacodigo.com.br]
> Gesendet: Mittwoch, 29. Juni 2016 23:12
> An: users@isis.apache.org
> Betreff: Security Module Addon Tables
>
> >Dear sirs,
> >
> >I'm currently developing a solution using Apache Isis. I have implemented
> Security Module Addon "out-of-box" according to Dan's video tutorial.
> >
> >I'm persisting all data on a SQL Server Database but none of Security's
> module tables are being created.
> >
> >Is there any additional configuration?
> >
> >Thanks,
> >
> >--
> >------------------------------------------------------------
> >Fábio Purcino Aragão
>
> ______________________________________________________________________
> Disclaimer: This email and any attachments are sent in strictest confidence
> for the sole use of the addressee and may contain legally privileged,
> confidential, and proprietary data. If you are not the intended recipient,
> please advise the sender by replying promptly to this email and then delete
> and destroy this email and any attachments without any further use, copying
> or forwarding.
>

AW: Security Module Addon Tables

Posted by Simecsek Timothy <Ti...@nttdata.com>.
Hi Fabio,

All Isis Modules are using their own schema since Apache ISIS 1.9 - have you checked if there are other schemas?

If you want to avoid that and generate the tables for security module in a specific schema I found the only working solution is with package.jdo in META-INF directory, but you need to specify all queries, here the excerpt for security module of mine package.jdo file:
<?xml version="1.0" encoding="UTF-8" ?>
<jdo xmlns="http://xmlns.jcp.org/xml/ns/jdo/jdo"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/jdo/jdo
        http://xmlns.jcp.org/xml/ns/jdo/jdo_3_0.xsd" version="3.0">

    <!-- Security Addon -->
    <package name="org.isisaddons.module.security.dom.user">
        <class name="ApplicationUser"
               schema="a1ff"
               table="IsisSecurityApplicationUser">
            <query name="findByUsername" language="JDOQL">
                SELECT FROM org.isisaddons.module.security.dom.user.ApplicationUser WHERE username == :username
            </query>
            <query name="findByEmailAddress" language="JDOQL">
                SELECT FROM org.isisaddons.module.security.dom.user.ApplicationUser WHERE emailAddress == :emailAddress
            </query>
            <query name="findByName" language="JDOQL">
                SELECT FROM org.isisaddons.module.security.dom.user.ApplicationUser WHERE username.matches(:nameRegex)   || familyName.matches(:nameRegex)   || givenName.matches(:nameRegex)   || knownAs.matches(:nameRegex)
            </query>
            <query name="find" language="JDOQL">
                SELECT FROM org.isisaddons.module.security.dom.user.ApplicationUser WHERE username.matches(:regex) || familyName.matches(:regex) || givenName.matches(:regex) || knownAs.matches(:regex) || emailAddress.matches(:regex)
            </query>
        </class>
    </package>
    <package name="org.isisaddons.module.security.dom.tenancy">
        <class name="ApplicationTenancy"
               schema="a1ff"
               table="IsisSecurityApplicationTenancy">
            <query name="findByPath" language="JDOQL">
                SELECT FROM org.isisaddons.module.security.dom.tenancy.ApplicationTenancy WHERE path == :path
            </query>
            <query name="findByName" language="JDOQL">
                SELECT FROM org.isisaddons.module.security.dom.tenancy.ApplicationTenancy WHERE name == :name
            </query>
            <query name="findByNameOrPathMatching" language="JDOQL">
                SELECT FROM org.isisaddons.module.security.dom.tenancy.ApplicationTenancy WHERE name.matches(:regex) || path.matches(:regex)
            </query>
        </class>
    </package>
    <package name="org.isisaddons.module.security.dom.permission">
        <class name="ApplicationPermission"
               schema="a1ff"
               table="IsisSecurityApplicationPermission">
            <query name="findByRole" language="JDOQL">
                SELECT FROM org.isisaddons.module.security.dom.permission.ApplicationPermission WHERE role == :role
            </query>
            <query name="findByUser" language="JDOQL">
                SELECT FROM org.isisaddons.module.security.dom.permission.ApplicationPermission WHERE (u.roles.contains(role) &amp;&amp; u.username == :username) VARIABLES org.isisaddons.module.security.dom.user.ApplicationUser u
            </query>
            <query name="findByFeature" language="JDOQL">
                SELECT FROM org.isisaddons.module.security.dom.permission.ApplicationPermission WHERE featureType == :featureType    &amp;&amp; featureFqn == :featureFqn
            </query>
            <query name="findByRoleAndRuleAndFeature" language="JDOQL">
                SELECT FROM org.isisaddons.module.security.dom.permission.ApplicationPermission WHERE role == :role    &amp;&amp; rule == :rule    &amp;&amp; featureType == :featureType    &amp;&amp; featureFqn == :featureFqn
            </query>
            <query name="findByRoleAndRuleAndFeatureType" language="JDOQL">
                SELECT FROM org.isisaddons.module.security.dom.permission.ApplicationPermission WHERE role == :role    &amp;&amp; rule == :rule    &amp;&amp; featureType == :featureType
            </query>
        </class>
    </package>
    <package name="org.isisaddons.module.security.dom.role">
        <class name="ApplicationRole"
               schema="a1ff"
               table="IsisSecurityApplicationRole">
            <query name="findByName" language="JDOQL">
                SELECT FROM org.isisaddons.module.security.dom.role.ApplicationRole WHERE name == :name
            </query>
            <query name="findByNameContaining" language="JDOQL">
                SELECT FROM org.isisaddons.module.security.dom.role.ApplicationRole WHERE name.matches(:nameRegex)
            </query>
        </class>
    </package>

Regards Timothy

-----Ursprüngliche Nachricht-----
Von: Fabio Purcino [mailto:fabio@viacodigo.com.br] 
Gesendet: Mittwoch, 29. Juni 2016 23:12
An: users@isis.apache.org
Betreff: Security Module Addon Tables

>Dear sirs,
>
>I'm currently developing a solution using Apache Isis. I have implemented Security Module Addon "out-of-box" according to Dan's video tutorial.
>
>I'm persisting all data on a SQL Server Database but none of Security's module tables are being created.
>
>Is there any additional configuration?
>
>Thanks,
>
>--
>------------------------------------------------------------
>Fábio Purcino Aragão

______________________________________________________________________
Disclaimer: This email and any attachments are sent in strictest confidence
for the sole use of the addressee and may contain legally privileged,
confidential, and proprietary data. If you are not the intended recipient,
please advise the sender by replying promptly to this email and then delete
and destroy this email and any attachments without any further use, copying
or forwarding.