Skip to content

Commit

Permalink
modified unlock model method to enable force unlock from an admin
Browse files Browse the repository at this point in the history
git-svn-id: svn://svn.forge.objectweb.org/svnroot/spagobi/V_4.x/Server/trunk@22974 99afaf0d-6903-0410-885a-c66a8bbb5f81
  • Loading branch information
mcortella committed Jun 13, 2014
1 parent b64c4d2 commit c9bb4be
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import it.eng.spagobi.commons.dao.AbstractHibernateDAO;
import it.eng.spagobi.commons.dao.SpagoBIDOAException;
import it.eng.spagobi.commons.utilities.UserUtilities;
import it.eng.spagobi.tools.catalogue.bo.Artifact;
import it.eng.spagobi.tools.catalogue.bo.Content;
import it.eng.spagobi.tools.catalogue.metadata.SbiArtifact;
Expand Down Expand Up @@ -791,8 +792,10 @@ public String unlockArtifact(Integer artifactId, String userId) {

logger.debug("Artifact loaded");
Artifact art = toArtifact(hibArtifact, session);
//Admin can force unlock from other
boolean isAdmin = UserUtilities.isAdministrator(UserUtilities.getUserProfile(userId));

if(art.getModelLocked().equals(true) && art.getModelLocker().equals(userId)){
if((art.getModelLocked().equals(true) && art.getModelLocker().equals(userId)) || (isAdmin)){
// set to not active the current active template
String hql = " update SbiArtifact ar set ar.modelLocked = ?, ar.modelLocker = ? where ar.modelLocked = ? and ar.id = ? ";
Query query = session.createQuery(hql);
Expand All @@ -801,7 +804,7 @@ public String unlockArtifact(Integer artifactId, String userId) {
query.setBoolean(2, true);
query.setInteger(3, artifactId);

logger.debug("Unloock the artifact with id " + artifactId + "");
logger.debug("Unlock the artifact with id " + artifactId + "");
query.executeUpdate();

userLocking = null;
Expand Down

0 comments on commit c9bb4be

Please sign in to comment.