dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #27937
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13928: fixes to SecurityService, make sure that object has sharing enabled
------------------------------------------------------------
revno: 13928
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2014-02-04 18:02:32 +0700
message:
fixes to SecurityService, make sure that object has sharing enabled
modified:
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/security/DefaultSecurityService.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-services/dhis-service-core/src/main/java/org/hisp/dhis/security/DefaultSecurityService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/security/DefaultSecurityService.java 2014-01-25 18:46:36 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/security/DefaultSecurityService.java 2014-02-04 11:02:32 +0000
@@ -200,7 +200,7 @@
public boolean restore( UserCredentials credentials, String token, String code, String newPassword, RestoreType restoreType )
{
if ( credentials == null || token == null || code == null || newPassword == null
- || !canRestoreNow( credentials, token, code, restoreType ) )
+ || !canRestoreNow( credentials, token, code, restoreType ) )
{
return false;
}
@@ -222,7 +222,7 @@
public boolean canRestoreNow( UserCredentials credentials, String token, String code, RestoreType restoreType )
{
- if ( !verifyToken ( credentials, token, restoreType ) )
+ if ( !verifyToken( credentials, token, restoreType ) )
{
return false;
}
@@ -264,54 +264,54 @@
@Override
public boolean canCreatePublic( IdentifiableObject identifiableObject )
{
- return SharingUtils.canCreatePublic( currentUserService.getCurrentUser(), identifiableObject );
+ return !SharingUtils.isSupported( identifiableObject.getClass() ) || SharingUtils.canCreatePublic( currentUserService.getCurrentUser(), identifiableObject );
}
@Override
public boolean canCreatePublic( String type )
{
- return SharingUtils.canCreatePublic( currentUserService.getCurrentUser(), type );
+ return !SharingUtils.isSupported( type ) || SharingUtils.canCreatePublic( currentUserService.getCurrentUser(), type );
}
@Override
public boolean canCreatePrivate( IdentifiableObject identifiableObject )
{
- return SharingUtils.canCreatePrivate( currentUserService.getCurrentUser(), identifiableObject );
+ return !SharingUtils.isSupported( identifiableObject.getClass() ) || SharingUtils.canCreatePrivate( currentUserService.getCurrentUser(), identifiableObject );
}
@Override
public boolean canCreatePrivate( String type )
{
- return SharingUtils.canCreatePrivate( currentUserService.getCurrentUser(), type );
+ return !SharingUtils.isSupported( type ) || SharingUtils.canCreatePrivate( currentUserService.getCurrentUser(), type );
}
@Override
public boolean canRead( IdentifiableObject identifiableObject )
{
- return SharingUtils.canRead( currentUserService.getCurrentUser(), identifiableObject );
+ return !SharingUtils.isSupported( identifiableObject.getClass() ) || SharingUtils.canRead( currentUserService.getCurrentUser(), identifiableObject );
}
@Override
public boolean canWrite( IdentifiableObject identifiableObject )
{
- return SharingUtils.canWrite( currentUserService.getCurrentUser(), identifiableObject );
+ return !SharingUtils.isSupported( identifiableObject.getClass() ) || SharingUtils.canWrite( currentUserService.getCurrentUser(), identifiableObject );
}
@Override
public boolean canUpdate( IdentifiableObject identifiableObject )
{
- return SharingUtils.canUpdate( currentUserService.getCurrentUser(), identifiableObject );
+ return !SharingUtils.isSupported( identifiableObject.getClass() ) || SharingUtils.canUpdate( currentUserService.getCurrentUser(), identifiableObject );
}
@Override
public boolean canDelete( IdentifiableObject identifiableObject )
{
- return SharingUtils.canDelete( currentUserService.getCurrentUser(), identifiableObject );
+ return !SharingUtils.isSupported( identifiableObject.getClass() ) || SharingUtils.canDelete( currentUserService.getCurrentUser(), identifiableObject );
}
@Override
public boolean canManage( IdentifiableObject identifiableObject )
{
- return SharingUtils.canManage( currentUserService.getCurrentUser(), identifiableObject );
+ return !SharingUtils.isSupported( identifiableObject.getClass() ) || SharingUtils.canManage( currentUserService.getCurrentUser(), identifiableObject );
}
}