dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #24084
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11756: default to public none for dashboards even if F_DASHBOARD_PUBLIC_ADD or ALL authorities are present
------------------------------------------------------------
revno: 11756
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-08-22 20:04:13 +0200
message:
default to public none for dashboards even if F_DASHBOARD_PUBLIC_ADD or ALL authorities are present
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/SharingUtils.java
dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/hibernate/HibernateGenericStore.java
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/SharingUtils.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/SharingUtils.java 2013-08-22 17:09:11 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/SharingUtils.java 2013-08-22 18:04:13 +0000
@@ -148,6 +148,11 @@
return CollectionUtils.containsAny( authorities, SHARING_OVERRIDE_AUTHORITIES ) || authorities.contains( PUBLIC_AUTHORITIES.get( clazz ) );
}
+ public static <T> boolean defaultPublic( Class<T> clazz )
+ {
+ return !Dashboard.class.isAssignableFrom( clazz );
+ }
+
public static boolean canCreatePublic( User user, IdentifiableObject identifiableObject )
{
return canCreatePublic( user, identifiableObject.getClass() );
=== modified file 'dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/hibernate/HibernateGenericStore.java'
--- dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/hibernate/HibernateGenericStore.java 2013-08-06 10:26:03 +0000
+++ dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/hibernate/HibernateGenericStore.java 2013-08-22 18:04:13 +0000
@@ -231,12 +231,20 @@
if ( SharingUtils.canCreatePublic( currentUserService.getCurrentUser(), identifiableObject ) )
{
- String build = AccessStringHelper.newInstance()
- .enable( AccessStringHelper.Permission.READ )
- .enable( AccessStringHelper.Permission.WRITE )
- .build();
+ if ( SharingUtils.defaultPublic( clazz ) )
+ {
+ String build = AccessStringHelper.newInstance()
+ .enable( AccessStringHelper.Permission.READ )
+ .enable( AccessStringHelper.Permission.WRITE )
+ .build();
- identifiableObject.setPublicAccess( build );
+ identifiableObject.setPublicAccess( build );
+ }
+ else
+ {
+ String build = AccessStringHelper.newInstance().build();
+ identifiableObject.setPublicAccess( build );
+ }
}
else if ( SharingUtils.canCreatePrivate( currentUserService.getCurrentUser(), identifiableObject ) )
{