ML Authentication Issues:

- Everyone, including guest, gets explicit full rights to each new cm:mlContainer instance.
 - The MultilingualContentService better permission checks against the content nodes that go in and out of it.
 - Changed some of the API return values to be more explicit about whether the cm:mlContainer or cm:mlDocument is required.
 - Added explicit tests to ensure that even guest is able to manipulate the cm:mlContainer.
ML Languages List:
 - The default value is now punted to the top of the list.
Various neatening.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5816 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2007-05-31 03:42:59 +00:00
parent 4ede1e61ab
commit 62965c458a
2 changed files with 7 additions and 50 deletions

View File

@@ -30,10 +30,8 @@ import javax.faces.context.FacesContext;
import javax.faces.model.SelectItem;
import org.alfresco.i18n.I18NUtil;
import org.alfresco.model.ContentModel;
import org.alfresco.service.cmr.ml.MultilingualContentService;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.namespace.QName;
import org.alfresco.web.bean.UserPreferencesBean;
import org.alfresco.web.bean.content.AddContentDialog;
import org.alfresco.web.bean.repository.Node;
@@ -49,7 +47,7 @@ public class AddTranslationlDialog extends AddContentDialog
private UserPreferencesBean userPreferencesBean;
// the multilingual container where to add this translation
protected NodeRef mlContainer;
protected NodeRef mlTranslation;
// Locale of the new translation
private String language;
@@ -67,7 +65,7 @@ public class AddTranslationlDialog extends AddContentDialog
super.init(parameters);
this.language = null;
setMlContainer(this.browseBean.getDocument().getNodeRef());
this.mlTranslation = this.browseBean.getDocument().getNodeRef();
setFileName(null);
unusedLanguages = null;
}
@@ -82,7 +80,7 @@ public class AddTranslationlDialog extends AddContentDialog
outcome = super.finishImpl(context, outcome);
// add a new translation
multilingualContentService.addTranslation(this.createdNode, this.mlContainer, I18NUtil.parseLocale(this.language));
multilingualContentService.addTranslation(this.createdNode, this.mlTranslation, I18NUtil.parseLocale(this.language));
this.browseBean.setDocument(new Node(this.createdNode));
@@ -124,44 +122,6 @@ public class AddTranslationlDialog extends AddContentDialog
this.language = language;
}
/**
* @return the Multilingual container where the translation will be associated
*/
public NodeRef getMlContainer()
{
return mlContainer;
}
/**
* Set the Multilingual container where the translation will be associated.
*
* @param mlContainer mlContainer is a MLDocument, the the MLContainer will
* become it's own MLContainer
*/
public void setMlContainer(NodeRef mlContainer)
{
QName type = null;
if(mlContainer != null)
{
type = nodeService.getType(mlContainer);
if(ContentModel.TYPE_MULTILINGUAL_CONTAINER.equals(type))
{
this.mlContainer = mlContainer;
}
else if (ContentModel.TYPE_CONTENT.equals(type)
&& nodeService.hasAspect(mlContainer, ContentModel.ASPECT_MULTILINGUAL_DOCUMENT))
{
this.mlContainer = multilingualContentService.getTranslationContainer(mlContainer);
}
else
{
this.mlContainer = null;
}
}
}
/**
* @param unusedLanguages
*/
@@ -180,7 +140,7 @@ public class AddTranslationlDialog extends AddContentDialog
{
if(unusedLanguages == null)
{
unusedLanguages = userPreferencesBean.getAvailablesContentFilterLanguages(getMlContainer(), false);
unusedLanguages = userPreferencesBean.getAvailablesContentFilterLanguages(this.mlTranslation, false);
}
return unusedLanguages;

View File

@@ -120,15 +120,13 @@ public class MakeMultilingualDialog extends BaseDialogBean
@Override
protected String finishImpl(FacesContext context, String outcome) throws Exception
{
Locale loc = I18NUtil.parseLocale(getLanguage());
Locale locale = I18NUtil.parseLocale(getLanguage());
NodeRef nodeRef = this.editableNode.getNodeRef();
// make this node multilingual
NodeRef mlContainer = multilingualContentService.makeTranslation(nodeRef, loc);
// set the local of the current node.
nodeService.setProperty(nodeRef, ContentModel.PROP_LOCALE, getLanguage());
multilingualContentService.makeTranslation(nodeRef, locale);
NodeRef mlContainer = multilingualContentService.getTranslationContainer(nodeRef);
// if the author of the node is not set, set it with the default author name of
// the new ML Container
@@ -138,7 +136,6 @@ public class MakeMultilingualDialog extends BaseDialogBean
// set properties of the ml container
nodeService.setProperty(mlContainer, ContentModel.PROP_AUTHOR, getAuthor());
nodeService.setProperty(mlContainer, ContentModel.PROP_LOCALE, getLanguage());
return outcome;
}