@Override public boolean isVisible() { final Brix brix = Brix.get(); final Workspace workspace = getWorkspaceModel().getObject(); final Action action = new AccessWebDavUrlPluginAction(workspace); final boolean granted = brix.getAuthorizationStrategy().isActionAuthorized(action); return granted; }
public boolean canAddNodeChild(BrixNode node, Context context) { if (!isNodeEditable(node)) { return false; } Action action = new SiteNodeAction(context, Type.NODE_ADD_CHILD, node); return brix.getAuthorizationStrategy().isActionAuthorized(action); }
public boolean canRenameNode(BrixNode node, Context context) { if (!isNodeEditable(node)) { return false; } Action action = new SiteNodeAction(context, Type.NODE_DELETE, node); return brix.getAuthorizationStrategy().isActionAuthorized(action); }
protected void initializeExtensionPoints(Brix brix) { ExtensionPointRegistry registry = brix.getConfig().getRegistry(); registry.register(RepositoryInitializer.POINT, new HierarchicalRepoInitializer()); registry.register(JcrNodeWrapperFactory.POINT, TitledNode.FACTORY); registry.register( getManageNodeTabFactoryExtensionPoint(), new ManageFolderNodeTabFactory(getPluginLocator())); }
/** * Creates a uri path for the specified <code>node</code> By default this method uses {@link * BrixConfig#getMapper()} to map node path to a uri path. * * @param node node to create uri path for * @return uri path that represents the node */ public Path getUriPathForNode(final BrixNode node) { // allow site plugin to translate jcr path into node path final String jcrPath = SitePlugin.get().fromRealWebNodePath(node.getPath()); final Path nodePath = new Path(jcrPath); // use urimapper to create the uri return brix.getConfig().getMapper().getUriPathForNode(nodePath, brix); }
private List<Workspace> getWorkspaces() { Brix brix = getBrix(); List<Workspace> workspaces = new ArrayList<Workspace>(); Workspace current = getModelObject(); for (Plugin p : brix.getPlugins()) { List<Workspace> filtered = brix.filterVisibleWorkspaces(p.getWorkspaces(current, false), Context.ADMINISTRATION); for (Workspace w : filtered) { if (workspaceNameCache == null) { workspaceNameCache = new HashMap<String, String>(); } workspaceNameCache.put(w.getId(), p.getUserVisibleName(w, false)); workspaces.add(w); } } if (!workspaces.contains(current)) { workspaces.add(current); } return workspaces; }
public void initWorkspace(Workspace workspace, JcrSession workspaceSession) { JcrNode root = (JcrNode) workspaceSession.getItem(brix.getRootPath()); JcrNode pluginRoot = null; if (root.hasNode(getRootNodeName())) { pluginRoot = root.getNode(getRootNodeName()); } else { pluginRoot = root.addNode(getRootNodeName(), SimpleFolderNode.JCR_PRIMARY_TYPE); } if (pluginRoot != null) { if (!pluginRoot.isNodeType(BrixNode.JCR_TYPE_BRIX_NODE)) { pluginRoot.addMixin(BrixNode.JCR_TYPE_BRIX_NODE); } } }
/** * Resolves uri path to a {@link BrixNode}. By default this method uses {@link * BrixConfig#getMapper()} to map the uri to a node path. * * @param uriPath uri path * @return node that maps to the <code>uriPath</code> or <code>null</code> if none */ public BrixNode getNodeForUriPath(final Path uriPath) { BrixNode node = null; // create desired nodepath final Path nodePath = brix.getConfig().getMapper().getNodePathForUriPath(uriPath.toAbsolute(), brix); if (nodePath != null) { // allow site plugin to translate the node path into an actual jcr // path final String jcrPath = SitePlugin.get().toRealWebNodePath(nodePath.toString()); // retrieve jcr session final String workspace = getWorkspace(); final JcrSession session = brix.getCurrentSession(workspace); if (session.itemExists(jcrPath)) { // node exists, return it node = (BrixNode) session.getItem(jcrPath); } } return node; }
private Brix getBrix() { return Brix.get(); }
public Workspace getObject() { if (workspace == null && workspaceId != null) { workspace = Brix.get().getWorkspaceManager().getWorkspace(workspaceId); } return workspace; }
public boolean canViewNodeChildren(BrixNode node, Context context) { Action action = new SiteNodeAction(context, Type.NODE_VIEW_CHILDREN, node); return brix.getAuthorizationStrategy().isActionAuthorized(action); }
public String getRootNodePath() { return brix.getRootPath() + "/" + getRootNodeName(); }
public Collection<? extends ManageNodeTabFactory> getManageNodeTabFactories() { return brix.getConfig().getRegistry().lookupCollection(getManageNodeTabFactoryExtensionPoint()); }
public Collection<? extends NodeEditorPlugin> getNodeEditorPlugins() { return brix.getConfig().getRegistry().lookupCollection(getNodeEditorPluginExtensionPoint()); }
private String getDefaultWorkspaceName() { final Workspace workspace = brix.getConfig().getMapper().getWorkspaceForRequest(RequestCycle.get(), brix); return (workspace != null) ? workspace.getId() : null; }
private boolean checkSession(String workspaceId) { return brix.getWorkspaceManager().workspaceExists(workspaceId); }