Skip to content

Commit

Permalink
Merge pull request #8 from uonafya/dennis-dev
Browse files Browse the repository at this point in the history
Access sharing and resolved hibernate cache strategy bug
  • Loading branch information
bangadennis authored Jan 19, 2017
2 parents 254a830 + a847a4b commit 24d6a77
Show file tree
Hide file tree
Showing 10 changed files with 79 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
<hibernate-mapping>
<class name="org.hisp.dhis.jphes.hierarchy.agency.AgencyUnit" table="jphes_agencyunit">

<cache usage="read-write" />

<id name="id" column="agencyunitid">
<generator class="native" />
</id>
Expand All @@ -31,16 +33,32 @@
foreign-key="fk_agencyunitcategoryoptiongroupid" not-null="true" />

<set name="programs" table="jphes_agencyunitprograms">
<cache usage="read-write" />
<key column="agencyunitid" foreign-key="fk_agencyunitprograms_agencyunitid" />
<many-to-many class="org.hisp.dhis.program.Program" column="programid"
foreign-key="fk_agencyunitprograms_programid" />
</set>

<set name="mechanismUnits" table="jphes_agencyunitmechanismunits">
<cache usage="read-write" />
<key column="agencyunitid" foreign-key="fk_agencyunitmechanismunits_agencyunitid" />
<many-to-many class="org.hisp.dhis.jphes.hierarchy.mechanism.MechanismUnit" column="mechanismunitid"
foreign-key="fk_agencyunitmechanismunit_mechanismunitid" />
</set>
<!-- Access properties -->

<many-to-one name="user" class="org.hisp.dhis.user.User"
column="userid" foreign-key="fk_agencyunit_userid" />

<property name="publicAccess" length="8" />

<set name="userGroupAccesses" table="agencyunitusergroupaccesses">
<cache usage="read-write" />
<key column="agencyunitid" />
<many-to-many class="org.hisp.dhis.user.UserGroupAccess"
column="usergroupaccessid" unique="true" />
</set>
</class>


</hibernate-mapping>
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
<hibernate-mapping>
<class name="org.hisp.dhis.jphes.hierarchy.donor.DonorUnit" table="jphes_donorunit">

<cache usage="read-write" />

<id name="id" column="donorunitid">
<generator class="native" />
</id>
Expand All @@ -32,16 +34,33 @@


<set name="agencyUnits" table="jphes_donorunitagencyunits">
<cache usage="read-write" />
<key column="donorunitid" foreign-key="fk_donorunitagencyunits_donorunitid" />
<many-to-many class="org.hisp.dhis.jphes.hierarchy.agency.AgencyUnit" column="agencyunitid"
foreign-key="fk_donorunitagencyunits_agencyunitid" />
</set>

<set name="programs" table="jphes_donorunitprograms">
<cache usage="read-write" />
<key column="donorunitid" foreign-key="fk_donorunitprograms_donorunitid" />
<many-to-many class="org.hisp.dhis.program.Program" column="programid"
foreign-key="fk_donorunitprograms_programid" />
</set>

<!-- Access properties -->

<many-to-one name="user" class="org.hisp.dhis.user.User"
column="userid" foreign-key="fk_donorunit_userid" />

<property name="publicAccess" length="8" />

<set name="userGroupAccesses" table="donorunitusergroupaccesses">
<cache usage="read-write" />
<key column="donorunitid" />
<many-to-many class="org.hisp.dhis.user.UserGroupAccess"
column="usergroupaccessid" unique="true" />
</set>

</class>

</hibernate-mapping>
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
<hibernate-mapping>
<class name="org.hisp.dhis.jphes.hierarchy.mechanism.MechanismUnit" table="jphes_mechanismunit">

<cache usage="read-write" />

<id name="id" column="mechanismunitid">
<generator class="native" />
</id>
Expand All @@ -33,10 +35,24 @@
foreign-key="fk_mechanismunitcategoryoptionid" not-null="true" />

<set name="programs" table="jphes_mechanismunitprograms">
<cache usage="read-write" />
<key column="mechanismunitid" foreign-key="fk_mechanismunitprograms_mechanismunitid" />
<many-to-many class="org.hisp.dhis.program.Program" column="programid"
foreign-key="fk_mechanismunitprograms_programid" />
</set>
<!-- Access properties -->

<many-to-one name="user" class="org.hisp.dhis.user.User"
column="userid" foreign-key="fk_mechanismunit_userid" />

<property name="publicAccess" length="8" />

<set name="userGroupAccesses" table="mechanismunitusergroupaccesses">
<cache usage="read-write" />
<key column="mechanismunitid" />
<many-to-many class="org.hisp.dhis.user.UserGroupAccess"
column="usergroupaccessid" unique="true" />
</set>
</class>

</hibernate-mapping>
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
<hibernate-mapping>
<class name="org.hisp.dhis.jphes.hierarchy.national.NationalUnit" table="jphes_nationalunit">

<cache usage="read-write" />

<id name="id" column="nationalunitid">
<generator class="native" />
</id>
Expand Down Expand Up @@ -37,16 +39,32 @@
foreign-key="fk_nationalunitcategoryoptiongroupsetdonorid" not-null="true" />

<set name="donorUnits" table="jphes_nationalunitdonorunits">
<cache usage="read-write" />
<key column="nationalunitid" foreign-key="fk_nationalunitdonorunits_nationalunitid" />
<many-to-many class="org.hisp.dhis.jphes.hierarchy.donor.DonorUnit" column="donorunitid"
foreign-key="fk_nationalunitdonorunits_donorunitid" />
</set>

<set name="programs" table="jphes_nationalunitprograms">
<cache usage="read-write" />
<key column="nationalunitid" foreign-key="fk_nationalunitprograms_nationalunitid" />
<many-to-many class="org.hisp.dhis.program.Program" column="programid"
foreign-key="fk_nationalunitprograms_programid" />
</set>
<!-- Access properties -->

<many-to-one name="user" class="org.hisp.dhis.user.User"
column="userid" foreign-key="fk_nationalunit_userid" />

<property name="publicAccess" length="8" />

<set name="userGroupAccesses" table="nationalunitusergroupaccesses">
<cache usage="read-write" />
<key column="nationalunitid" />
<many-to-many class="org.hisp.dhis.user.UserGroupAccess"
column="usergroupaccessid" unique="true" />
</set>

</class>

</hibernate-mapping>
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import org.springframework.beans.factory.annotation.Autowired;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import static org.apache.commons.lang.StringUtils.isNotBlank;
Expand Down Expand Up @@ -55,6 +56,8 @@ public MechanismUnit getMechanismUnit(){
this.paging = createPaging(mechanismUnit.getCategoryOption().getOrganisationUnits().size());

organisationUnits = new ArrayList<>(mechanismUnit.getCategoryOption().getOrganisationUnits());

Collections.sort(organisationUnits);
}
else{

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ public void setSelectedProgramList( Collection<String> selectedProgramList )
accessNational.setAccess( READWRITEACCESS );
userGroupAccessService.addUserGroupAccess( accessNational );

// UserGroup sharing
// UserGroup & National Unit sharing
userGroup.setPublicAccess( NOPUBLICACCESS);
userGroup.getUserGroupAccesses().add( accessNational );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<div id="contextMenu" class="contextMenu">
<ul id="contextMenuItems" class="contextMenuItems">
## <li data-enabled="canManage"><a data-target-fn="showSharingDialogWithContext"><i class="fa fa-share"></i>&nbsp;&nbsp;$i18n.getString( "sharing_settings" )</a></li>
<li data-enabled="canManage"><a data-target-fn="showSharingDialogWithContext"><i class="fa fa-share"></i>&nbsp;&nbsp;$i18n.getString( "sharing_settings" )</a></li>
<li data-enabled="canUpdate"><a data-target-fn="showAddMechanismUnitForm"><i class="fa fa-plus"></i>&nbsp;&nbsp;$i18n.getString( "add_mechanism" )</a></li>
<li data-enabled="canUpdate"><a data-target-fn="showUpdateAgencyUnitForm"><i class="fa fa-edit"></i>&nbsp;&nbsp;$i18n.getString( "edit" )</a></li>
<li data-enabled="canDelete"><a data-target-fn="removeAgencyUnit"><i class="fa fa-trash-o"></i>&nbsp;&nbsp;$i18n.getString( "remove" )</a></li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<div id="contextMenu" class="contextMenu">
<ul id="contextMenuItems" class="contextMenuItems">
## <li data-enabled="canManage"><a data-target-fn="showSharingDialogWithContext"><i class="fa fa-share"></i>&nbsp;&nbsp;$i18n.getString( "sharing_settings" )</a></li>
<li data-enabled="canManage"><a data-target-fn="showSharingDialogWithContext"><i class="fa fa-share"></i>&nbsp;&nbsp;$i18n.getString( "sharing_settings" )</a></li>
<li data-enabled="canUpdate"><a data-target-fn="showAddAgencyUnitForm"><i class="fa fa-plus"></i>&nbsp;&nbsp;$i18n.getString( "add_agency" )</a></li>
<li data-enabled="canUpdate"><a data-target-fn="showUpdateDonorUnitForm"><i class="fa fa-edit"></i>&nbsp;&nbsp;$i18n.getString( "edit" )</a></li>
<li data-enabled="canDelete"><a data-target-fn="removeDonorUnit"><i class="fa fa-trash-o"></i>&nbsp;&nbsp;$i18n.getString( "remove" )</a></li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<div id="contextMenu" class="contextMenu">
<ul id="contextMenuItems" class="contextMenuItems">
## <li data-enabled="canManage"><a data-target-fn="showSharingDialogWithContext"><i class="fa fa-share"></i>&nbsp;&nbsp;$i18n.getString( "sharing_settings" )</a></li>
<li data-enabled="canManage"><a data-target-fn="showSharingDialogWithContext"><i class="fa fa-share"></i>&nbsp;&nbsp;$i18n.getString( "sharing_settings" )</a></li>
<li data-enabled="canUpdate"><a data-target-fn="viewOrganistionUnits"><i class="fa fa-eye"></i>&nbsp;&nbsp;$i18n.getString( "view_orgunits" )</a></li>
<li data-enabled="canUpdate"><a data-target-fn="showUpdateMechanismUnitForm"><i class="fa fa-edit"></i>&nbsp;&nbsp;$i18n.getString( "edit" )</a></li>
<li data-enabled="canDelete"><a data-target-fn="removeMechanismUnit"><i class="fa fa-trash-o"></i>&nbsp;&nbsp;$i18n.getString( "remove" )</a></li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<div id="contextMenu" class="contextMenu">
<ul id="contextMenuItems" class="contextMenuItems">
## <li data-enabled="canManage"><a data-target-fn="showSharingDialogWithContext"><i class="fa fa-share"></i>&nbsp;&nbsp;$i18n.getString( "sharing_settings" )</a></li>
<li data-enabled="canManage"><a data-target-fn="showSharingDialogWithContext"><i class="fa fa-share"></i>&nbsp;&nbsp;$i18n.getString( "sharing_settings" )</a></li>
<li data-enabled="canUpdate"><a data-target-fn="showAddDonorUnitForm"><i class="fa fa-plus"></i>&nbsp;&nbsp;$i18n.getString( "add_donor" )</a></li>
<li data-enabled="canUpdate"><a data-target-fn="showUpdateNationalUnitForm"><i class="fa fa-edit"></i>&nbsp;&nbsp;$i18n.getString( "edit" )</a></li>
<li data-enabled="canDelete"><a data-target-fn="removeNationalUnit"><i class="fa fa-trash-o"></i>&nbsp;&nbsp;$i18n.getString( "remove" )</a></li>
Expand Down

0 comments on commit 24d6a77

Please sign in to comment.