Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@
# specific language governing permissions and limitations
# under the License.
missingEntitlement=MISSING ENTITLEMENT: CONNECTOR_READ

menu.Topology=Topology
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@
# specific language governing permissions and limitations
# under the License.
missingEntitlement=DROIT MANQUANT : CONNECTOR_READ

menu.Topology=Topologie
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@
# specific language governing permissions and limitations
# under the License.
missingEntitlement=ENTITLEMENT MANCANTE: CONNECTOR_READ

menu.Topology=Topologia
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@
# specific language governing permissions and limitations
# under the License.
missingEntitlement=\u6a29\u5229\u4ed8\u4e0e\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093: CONNECTOR_READ

menu.Topology=\u30c8\u30dd\u30ed\u30b8\u30fc
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@
# specific language governing permissions and limitations
# under the License.
missingEntitlement=MISSING ENTITLEMENT: CONNECTOR_READ

menu.Topology=Topologia
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# missingEntitlement=Нет прав доступа на просмотр коннектора (CONNECTOR_READ)
missingEntitlement=\u041d\u0435\u0442 \u043f\u0440\u0430\u0432 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043d\u0430 \u0447\u0442\u0435\u043d\u0438\u0435 \u043a\u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440 \u043a\u043e\u043d\u043d\u0435\u043a\u0442\u043e\u0440\u0430 (CONNECTOR_READ)

menu.Topology=\u0442\u043e\u043f\u043e\u043b\u043e\u0433\u0438\u044f
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.syncope.client.ui.commons;

import java.util.HashMap;
import java.util.Map;

public final class DynamicMenuRegister {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


private static final Map<String, Class<?>> KEYS_FOR_PAGES = new HashMap<>();

private DynamicMenuRegister() {
}

public static void register(final String key, final Class<?> pageClass) {
KEYS_FOR_PAGES.put(key, pageClass);
}

public static Class<?> getPage(final String key) {
return KEYS_FOR_PAGES.get(key);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.syncope.client.ui.commons;

import java.util.Locale;
import org.apache.wicket.core.util.resource.locator.IResourceNameIterator;
import org.apache.wicket.resource.IPropertiesFactory;
import org.apache.wicket.resource.Properties;
import org.apache.wicket.resource.loader.ClassStringResourceLoader;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class DynamicMenuStringResourceLoader extends ClassStringResourceLoader {

protected static final Logger LOG = LoggerFactory.getLogger(DynamicMenuStringResourceLoader.class);

public DynamicMenuStringResourceLoader() {
super(DynamicMenuStringResourceLoader.class);
}

@Override
public String loadStringResource(
final Class<?> clazz,
final String key,
final Locale locale,
final String style,
final String variation) {

if (key != null && key.startsWith("menu.")) {
Class<?> pageClass = DynamicMenuRegister.getPage(key);

if (pageClass != null) {
final String path = pageClass.getName().replace('.', '/');
final IResourceNameIterator iter = newResourceNameIterator(path, locale, style, variation);
final IPropertiesFactory propertiesFactory = getPropertiesFactory();

while (iter.hasNext()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use streams, not iterators

final String newPath = iter.next();
final Properties props = propertiesFactory.load(pageClass, newPath);

if (props != null) {
final String localeLabel = props.getString(key);
LOG.debug("Found label \"{}\" for key: {}", localeLabel, key);
return localeLabel;
}
}
}
}

return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import org.apache.syncope.client.console.commons.RealmsUtils;
import org.apache.syncope.client.console.commons.StatusProvider;
import org.apache.syncope.client.console.init.ClassPathScanImplementationLookup;
import org.apache.syncope.client.console.pages.BaseExtPage;
import org.apache.syncope.client.console.pages.BasePage;
import org.apache.syncope.client.console.pages.Dashboard;
import org.apache.syncope.client.console.pages.Login;
Expand All @@ -52,7 +53,10 @@
import org.apache.syncope.client.ui.commons.BaseSession;
import org.apache.syncope.client.ui.commons.BaseWebApplication;
import org.apache.syncope.client.ui.commons.Constants;
import org.apache.syncope.client.ui.commons.DynamicMenuRegister;
import org.apache.syncope.client.ui.commons.DynamicMenuStringResourceLoader;
import org.apache.syncope.client.ui.commons.SyncopeUIRequestCycleListener;
import org.apache.syncope.client.ui.commons.annotations.ExtPage;
import org.apache.syncope.client.ui.commons.annotations.Resource;
import org.apache.syncope.client.ui.commons.themes.AdminLTE;
import org.apache.syncope.client.ui.commons.wizards.AjaxWizard;
Expand Down Expand Up @@ -240,6 +244,26 @@ protected void init() {

mountPage("/login", getSignInPageClass());

//[SYNCOPE-1942]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to comment with issue reference, we have git blame for this

//--
final List<Class<? extends BasePage>> amPageClasses = lookup.getAMPageClasses();
amPageClasses.forEach(claz -> {
DynamicMenuRegister.register("menu." + claz.getSimpleName(), claz);
});

final List<Class<? extends BasePage>> idmPageClasses = lookup.getIdMPageClasses();
idmPageClasses.forEach(claz -> {
DynamicMenuRegister.register("menu." + claz.getSimpleName(), claz);
});

final List<Class<? extends BaseExtPage>> extPageClasses = lookup.getClasses(BaseExtPage.class);
extPageClasses.stream().filter(claz -> (claz.isAnnotationPresent(ExtPage.class))).forEach(claz -> {
DynamicMenuRegister.register("menu." + claz.getSimpleName(), claz);
});

getResourceSettings().getStringResourceLoaders().add(new DynamicMenuStringResourceLoader());
//--

for (IResource resource : resources) {
Class<?> resourceClass = AopUtils.getTargetClass(resource);
Resource annotation = resourceClass.getAnnotation(Resource.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ protected void populateItem(final ListItem<Class<? extends BasePage>> item) {
IdMPage ann = item.getModelObject().getAnnotation(IdMPage.class);

BookmarkablePageLink<Page> link = new BookmarkablePageLink<>("idmPage", item.getModelObject());
link.add(new Label("idmPageLabel", ann.label()));
link.add(new Label("idmPageLabel", getString("menu." + ann.label(), null, ann.label())));
if (StringUtils.isNotBlank(ann.listEntitlement())) {
MetaDataRoleAuthorizationStrategy.authorize(link, WebPage.RENDER, ann.listEntitlement());
}
Expand Down Expand Up @@ -226,7 +226,8 @@ protected void populateItem(final ListItem<Class<? extends BasePage>> item) {
AMPage ann = item.getModelObject().getAnnotation(AMPage.class);

BookmarkablePageLink<Page> link = new BookmarkablePageLink<>("amPage", item.getModelObject());
link.add(new Label("amPageLabel", ann.label()));
link.add(new Label("amPageLabel", getString("menu." + ann.label(), null, ann.label())));

if (StringUtils.isNotBlank(ann.listEntitlement())) {
MetaDataRoleAuthorizationStrategy.authorize(link, WebPage.RENDER, ann.listEntitlement());
}
Expand Down Expand Up @@ -521,7 +522,7 @@ protected void populateItem(final ListItem<Class<? extends BaseExtPage>> item) {
ExtPage ann = item.getModelObject().getAnnotation(ExtPage.class);

BookmarkablePageLink<Page> link = new BookmarkablePageLink<>("extPage", item.getModelObject());
link.add(new Label("extPageLabel", ann.label()));
link.add(new Label("extPageLabel", getString("menu." + ann.label(), null, ann.label())));
if (StringUtils.isNotBlank(ann.listEntitlement())) {
MetaDataRoleAuthorizationStrategy.authorize(link, WebPage.RENDER, ann.listEntitlement());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# under the License.
home=Home
version=Version
domain=Domain
domain=Domain
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert this space-adding change


systemInfo=System Information
hostname=Host Name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@
import org.apache.syncope.client.lib.SyncopeClientFactoryBean;
import org.apache.syncope.client.ui.commons.BaseLogin;
import org.apache.syncope.client.ui.commons.BaseWebApplication;
import org.apache.syncope.client.ui.commons.DynamicMenuRegister;
import org.apache.syncope.client.ui.commons.DynamicMenuStringResourceLoader;
import org.apache.syncope.client.ui.commons.SyncopeUIRequestCycleListener;
import org.apache.syncope.client.ui.commons.annotations.ExtPage;
import org.apache.syncope.client.ui.commons.annotations.Resource;
import org.apache.syncope.client.ui.commons.themes.AdminLTE;
import org.apache.syncope.common.keymaster.client.api.ServiceOps;
Expand Down Expand Up @@ -203,6 +206,26 @@ public IResource getResource() {
}
}

//[SYNCOPE-1942]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

//--
final List<Class<? extends BasePage>> amPageClasses = lookup.getAMPageClasses();
amPageClasses.forEach(claz -> {
DynamicMenuRegister.register("menu." + claz.getSimpleName(), claz);
});

final List<Class<? extends BasePage>> idmPageClasses = lookup.getIdMPageClasses();
idmPageClasses.forEach(claz -> {
DynamicMenuRegister.register("menu." + claz.getSimpleName(), claz);
});

final List<Class<? extends BasePage>> extPageClasses = lookup.getExtPageClasses();
extPageClasses.stream().filter(claz -> (claz.isAnnotationPresent(ExtPage.class))).forEach(claz -> {
DynamicMenuRegister.register("menu." + claz.getSimpleName(), claz);
});

getResourceSettings().getStringResourceLoaders().add(new DynamicMenuStringResourceLoader());
//--

try (InputStream is = resourceLoader.getResource(props.getCustomFormLayout()).getInputStream()) {
customFormLayout = MAPPER.readValue(is, new TypeReference<>() {
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,7 @@ protected void populateItem(final ListItem<Class<? extends BasePage>> item) {
IdMPage ann = item.getModelObject().getAnnotation(IdMPage.class);

BookmarkablePageLink<Page> link = new BookmarkablePageLink<>("idmPage", item.getModelObject());

link.add(new Label("idmPageLabel", ann.label()));
link.add(new Label("idmPageLabel", getString("menu." + ann.label(), null, ann.label())));

if (item.getModelObject().equals(pageRef.getPage().getClass())) {
link.add(new Behavior() {
Expand Down Expand Up @@ -177,8 +176,7 @@ protected void populateItem(final ListItem<Class<? extends BasePage>> item) {
AMPage ann = item.getModelObject().getAnnotation(AMPage.class);

BookmarkablePageLink<Page> link = new BookmarkablePageLink<>("amPage", item.getModelObject());

link.add(new Label("amPageLabel", ann.label()));
link.add(new Label("amPageLabel", getString("menu." + ann.label(), null, ann.label())));

if (item.getModelObject().equals(pageRef.getPage().getClass())) {
link.add(new Behavior() {
Expand Down Expand Up @@ -216,8 +214,7 @@ protected void populateItem(final ListItem<Class<? extends BasePage>> item) {
ExtPage ann = item.getModelObject().getAnnotation(ExtPage.class);

BookmarkablePageLink<Page> link = new BookmarkablePageLink<>("extPage", item.getModelObject());

link.add(new Label("extPageLabel", ann.label()));
link.add(new Label("extPageLabel", getString("menu." + ann.label(), null, ann.label())));

if (item.getModelObject().equals(pageRef.getPage().getClass())) {
link.add(new Behavior() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@
xmlEditorTitle=Workflow XML Editor
userWorkflow=User workflow
external_editor.title=Flowable Modeler

menu.Flowable=Flowable
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
xmlEditorTitle=XML \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u0441\u043e\u0433\u043b\u0430\u0441\u043e\u0432\u0430\u043d\u0438\u044f
userWorkflow=User workflow
external_editor.title=Flowable Modeler

menu.Flowable=Flowable
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@
xmlEditorTitle=Workflow XML Editor
userWorkflow=Workflow utenti
external_editor.title=Flowable Modeler

menu.Flowable=Flowable
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@
xmlEditorTitle=\u30ef\u30fc\u30af\u30d5\u30ed\u30fc XML \u30a8\u30c7\u30a3\u30bf\u30fc
userWorkflow=\u30e6\u30fc\u30b6\u30fc\u30ef\u30fc\u30af\u30d5\u30ed\u30fc
external_editor.title=Flowable \u30e2\u30c7\u30e9\u30fc

menu.Flowable=Flowable
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@
xmlEditorTitle=Workflow XML Editor
userWorkflow=User workflow
external_editor.title=Flowable Modeler

menu.Flowable=Flowable
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@
xmlEditorTitle=XML \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u0441\u043e\u0433\u043b\u0430\u0441\u043e\u0432\u0430\u043d\u0438\u044f
userWorkflow=User workflow
external_editor.title=Flowable Modeler

menu.Flowable=Flowable
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
import org.apache.wicket.request.mapper.parameter.PageParameters;
import org.apache.wicket.spring.injection.annot.SpringBean;

@ExtPage(label = "User Requests", icon = "fa fa-briefcase", listEntitlement = "")
@ExtPage(label = "Flowable", icon = "fa fa-briefcase", listEntitlement = "")
public class Flowable extends BaseExtPage {

private static final long serialVersionUID = -8781434495150074529L;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@ delete=Delete
start=Start
requests.to.be.approved=Your active requests
activityId=Activity Id

menu.Flowable=User Requests
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
user.requests.accordion=${bpmnProcess} (${activityId})
bpmn.process.title=Richieste
submit=Salva
executionId=Id esecuzione
startTime=Eseguito il
delete=Cancella
start=Esegui
requests.to.be.approved=Richieste in lavorazione
activityId=Id attivit\u00e0

menu.Flowable=Demandes des utilisateurs
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@ delete=Cancella
start=Esegui
requests.to.be.approved=Richieste in lavorazione
activityId=Id attivit\u00e0

menu.Flowable=Richieste utente
Loading
Loading