|
From: Boleslaw D. <bd...@o2...> - 2006-07-07 07:33:13
|
User: bdaw
Date: 06/07/07 03:30:49
Modified: migration/src/main/org/jboss/portal/migration
MigrationModule22_24.java
Log:
fixed wrong table name in migration app schema
Revision Changes Path
1.21 +33 -6 jboss-portal/migration/src/main/org/jboss/portal/migration/MigrationModule22_24.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: MigrationModule22_24.java
===================================================================
RCS file: /cvsroot/jboss/jboss-portal/migration/src/main/org/jboss/portal/migration/MigrationModule22_24.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -b -r1.20 -r1.21
--- MigrationModule22_24.java 20 Jun 2006 12:56:00 -0000 1.20
+++ MigrationModule22_24.java 7 Jul 2006 07:30:49 -0000 1.21
@@ -37,6 +37,7 @@
import org.jboss.portal.migration.model24.portal.PortalObject24Impl;
import org.jboss.portal.migration.model24.portal.ObjectNodeSecurityConstraint;
import org.jboss.portal.migration.model24.portal.Portal24Impl;
+import org.jboss.portal.migration.model24.portal.Context24Impl;
import org.jboss.portal.migration.model24.instance.Instance24Impl;
import org.jboss.portal.migration.model24.instance.UserInstance24;
import org.jboss.portal.migration.model24.instance.InstanceSecurityBinding;
@@ -71,7 +72,7 @@
*
* @author <a href="mailto:ro...@jb...">Roy Russo</a>
* @author <a href="mailto:bol...@jb...">Boleslaw Dawidowicz</a>
- * @version $Revision: 1.20 $
+ * @version $Revision: 1.21 $
*/
public class MigrationModule22_24 extends MigrationModule
{
@@ -544,13 +545,38 @@
log.info("Starting migrating security policies...");
+ /*//at first just create allow permissions for every context object
+ //TODO: change this to migrate true portal permissions
+ Query portalQuery = toSession.createQuery("FROM Context24Impl");
+ for (Iterator portals = portalQuery.iterate(); portals.hasNext();)
+ {
+ Context24Impl context = (Context24Impl)portals.next();
+ log.debug("Updating security for context: " + context.getObjectNode().getPath() );
+ ObjectNodeSecurityConstraint constraint = new ObjectNodeSecurityConstraint();
+ constraint.setRole("__unchecked__");
+ Set actions = new HashSet();
+ actions.add("view");
+ constraint.setActions(actions);
+ constraint.setObjectNode(context.getObjectNode());
+
+ if (context.getObjectNode().getSecurityConstraints() == null)
+ {
+ context.getObjectNode().setSecurityConstraints(new HashMap());
+ }
+ //Map constraints = new HashMap();
+ context.getObjectNode().getSecurityConstraints().put(context.getObjectNode().getKey(), constraint);
+ //portal.getObjectNode().setSecurityConstraints(constraints);
+
+ toSession.save(constraint);
+ }*/
+
//at first just create allow permissions for every portal object
//TODO: change this to migrate true portal permissions
- Query portalQuery = toSession.createQuery("FROM Portal24Impl");
+ /*Query portalQuery = toSession.createQuery("FROM Portal24Impl");
for (Iterator portals = portalQuery.iterate(); portals.hasNext();)
{
Portal24Impl portal = (Portal24Impl)portals.next();
- log.debug("Migrating portal: " + portal.getObjectNode().getPath() );
+ log.info("Updating security for portal: " + portal.getObjectNode().getPath() );
ObjectNodeSecurityConstraint constraint = new ObjectNodeSecurityConstraint();
constraint.setRole("__unchecked__");
Set actions = new HashSet();
@@ -567,7 +593,7 @@
//portal.getObjectNode().setSecurityConstraints(constraints);
toSession.save(constraint);
- }
+ }*/
//then iterate and convert permissions for nodes and instances
Query query = fromSession.createQuery("SELECT key FROM SecurityPolicy ORDER BY key");
@@ -582,7 +608,7 @@
String parentRef = sp.getParentReference();
- log.debug("Migrating policy from: " + sp.getReference());
+ log.info("Migrating policy from: " + sp.getReference());
String path = "";
@@ -593,7 +619,7 @@
else if (parentRef.equals("/portalobject"))
{
path = cutPath(sp.getParentReference(), sp.getReference());
- log.debug("Migrating portalobject: " + path);
+ log.info("Migrating portalobject: " + path);
ObjectNode24 objectNode24 = (ObjectNode24)toSession.createCriteria(ObjectNode24.class).add(Restrictions.eq("path", path)).uniqueResult();
if (objectNode24 == null)
@@ -612,6 +638,7 @@
ObjectNodeSecurityConstraint nodeConstraint = MigrationUtils.cloneConstraintToObjectNodeConstraint(hsc);
nodeConstraint.setObjectNode(objectNode24);
objectNode24.getSecurityConstraints().put(objectNode24.getKey(), nodeConstraint);
+ log.debug("Security Constraint for node: " + objectNode24.getKey());
toSession.save(nodeConstraint);
}
|