Repository: syncope Updated Branches: refs/heads/master 66a119333 -> 3fc2f962b
[SYNCOPE-156] Sample notification area for TODOs Project: http://git-wip-us.apache.org/repos/asf/syncope/repo Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/3fc2f962 Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/3fc2f962 Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/3fc2f962 Branch: refs/heads/master Commit: 3fc2f962b2ef8c511dc4defa585e3614730ad69c Parents: 66a1193 Author: Francesco Chicchiriccò <[email protected]> Authored: Tue May 5 12:58:31 2015 +0200 Committer: Francesco Chicchiriccò <[email protected]> Committed: Tue May 5 12:58:31 2015 +0200 ---------------------------------------------------------------------- .../client/console/SyncopeConsoleSession.java | 4 ++ .../syncope/client/console/pages/BasePage.java | 15 +++++++ .../client/console/rest/ApprovalRestClient.java | 45 -------------------- .../console/rest/UserWorkflowRestClient.java | 42 ++++++++++++++++++ .../syncope/client/console/pages/BasePage.html | 13 ++++++ .../client/console/pages/Workflow.properties | 17 ++++++++ .../client/console/pages/Workflow_it.properties | 17 ++++++++ .../console/pages/Workflow_pt_BR.properties | 17 ++++++++ 8 files changed, 125 insertions(+), 45 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/syncope/blob/3fc2f962/client/console/src/main/java/org/apache/syncope/client/console/SyncopeConsoleSession.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/SyncopeConsoleSession.java b/client/console/src/main/java/org/apache/syncope/client/console/SyncopeConsoleSession.java index 8a5add1..f162357 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/SyncopeConsoleSession.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/SyncopeConsoleSession.java @@ -124,6 +124,10 @@ public class SyncopeConsoleSession extends AuthenticatedWebSession { return selfTO; } + public boolean owns(final String entitlement) { + return auth.containsKey(entitlement); + } + @Override public Roles getRoles() { if (isSignedIn() && roles == null && auth != null) { http://git-wip-us.apache.org/repos/asf/syncope/blob/3fc2f962/client/console/src/main/java/org/apache/syncope/client/console/pages/BasePage.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/pages/BasePage.java b/client/console/src/main/java/org/apache/syncope/client/console/pages/BasePage.java index 434a620..7855813 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/pages/BasePage.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/pages/BasePage.java @@ -20,6 +20,7 @@ package org.apache.syncope.client.console.pages; import org.apache.syncope.client.console.SyncopeConsoleSession; import org.apache.syncope.client.console.commons.Constants; +import org.apache.syncope.client.console.rest.UserWorkflowRestClient; import org.apache.syncope.common.lib.types.Entitlement; import org.apache.wicket.Component; import org.apache.wicket.Page; @@ -34,11 +35,15 @@ import org.apache.wicket.markup.html.WebPage; import org.apache.wicket.markup.html.basic.Label; import org.apache.wicket.markup.html.link.BookmarkablePageLink; import org.apache.wicket.request.mapper.parameter.PageParameters; +import org.apache.wicket.spring.injection.annot.SpringBean; public class BasePage extends AbstractBasePage implements IAjaxIndicatorAware { private static final long serialVersionUID = 1571997737305598502L; + @SpringBean + private UserWorkflowRestClient userWorkflowRestClient; + public BasePage() { this(null); } @@ -54,9 +59,19 @@ public class BasePage extends AbstractBasePage implements IAjaxIndicatorAware { public BasePage(final PageParameters parameters) { super(parameters); + // header, footer add(new Label("version", SyncopeConsoleSession.get().getVersion())); add(new Label("username", SyncopeConsoleSession.get().getSelfTO().getUsername())); + WebMarkupContainer todosContainer = new WebMarkupContainer("todosContainer"); + add(todosContainer); + Label todos = new Label("todos", "0"); + todosContainer.add(todos); + if (SyncopeConsoleSession.get().owns(Entitlement.WORKFLOW_FORM_LIST)) { + todos.setDefaultModelObject(userWorkflowRestClient.getForms().size()); + } + MetaDataRoleAuthorizationStrategy.authorize(todosContainer, WebPage.RENDER, Entitlement.WORKFLOW_FORM_LIST); + // menu WebMarkupContainer liContainer = new WebMarkupContainer(getLIContainerId("dashboard")); add(liContainer); http://git-wip-us.apache.org/repos/asf/syncope/blob/3fc2f962/client/console/src/main/java/org/apache/syncope/client/console/rest/ApprovalRestClient.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/rest/ApprovalRestClient.java b/client/console/src/main/java/org/apache/syncope/client/console/rest/ApprovalRestClient.java deleted file mode 100644 index b0a19aa..0000000 --- a/client/console/src/main/java/org/apache/syncope/client/console/rest/ApprovalRestClient.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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.console.rest; - -import java.util.List; -import org.apache.syncope.common.lib.to.WorkflowFormTO; -import org.apache.syncope.common.rest.api.service.UserWorkflowService; -import org.springframework.stereotype.Component; - -/** - * Console client for invoking Rest Todo services. - */ -@Component -public class ApprovalRestClient extends BaseRestClient { - - private static final long serialVersionUID = -4785231164900813921L; - - public List<WorkflowFormTO> getForms() { - return getService(UserWorkflowService.class).getForms(); - } - - public WorkflowFormTO claimForm(final String taskKey) { - return getService(UserWorkflowService.class).claimForm(taskKey); - } - - public void submitForm(final WorkflowFormTO form) { - getService(UserWorkflowService.class).submitForm(form); - } -} http://git-wip-us.apache.org/repos/asf/syncope/blob/3fc2f962/client/console/src/main/java/org/apache/syncope/client/console/rest/UserWorkflowRestClient.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/rest/UserWorkflowRestClient.java b/client/console/src/main/java/org/apache/syncope/client/console/rest/UserWorkflowRestClient.java new file mode 100644 index 0000000..bb99755 --- /dev/null +++ b/client/console/src/main/java/org/apache/syncope/client/console/rest/UserWorkflowRestClient.java @@ -0,0 +1,42 @@ +/* + * 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.console.rest; + +import java.util.List; +import org.apache.syncope.common.lib.to.WorkflowFormTO; +import org.apache.syncope.common.rest.api.service.UserWorkflowService; +import org.springframework.stereotype.Component; + +@Component +public class UserWorkflowRestClient extends BaseRestClient { + + private static final long serialVersionUID = -4785231164900813921L; + + public List<WorkflowFormTO> getForms() { + return getService(UserWorkflowService.class).getForms(); + } + + public WorkflowFormTO claimForm(final String taskKey) { + return getService(UserWorkflowService.class).claimForm(taskKey); + } + + public void submitForm(final WorkflowFormTO form) { + getService(UserWorkflowService.class).submitForm(form); + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/3fc2f962/client/console/src/main/resources/org/apache/syncope/client/console/pages/BasePage.html ---------------------------------------------------------------------- diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/BasePage.html b/client/console/src/main/resources/org/apache/syncope/client/console/pages/BasePage.html index 7546a6a..f640006 100644 --- a/client/console/src/main/resources/org/apache/syncope/client/console/pages/BasePage.html +++ b/client/console/src/main/resources/org/apache/syncope/client/console/pages/BasePage.html @@ -62,6 +62,19 @@ under the License. </a> <div class="navbar-custom-menu"> <ul class="nav navbar-nav"> + + <li class="dropdown tasks-menu" wicket:id="todosContainer"> + <a href="#" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false"> + <i class="fa fa-flag-o"></i> + <span class="label label-danger" wicket:id="todos"></span> + </a> + <ul class="dropdown-menu"> + <li class="footer"> + <a href="#">View all TODOs</a> + </li> + </ul> + </li> + <li class="dropdown user user-menu"> <a href="#" class="dropdown-toggle" data-toggle="dropdown"> <!-- hidden-xs hides the username on small devices so only the image appears. --> http://git-wip-us.apache.org/repos/asf/syncope/blob/3fc2f962/client/console/src/main/resources/org/apache/syncope/client/console/pages/Workflow.properties ---------------------------------------------------------------------- diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/Workflow.properties b/client/console/src/main/resources/org/apache/syncope/client/console/pages/Workflow.properties new file mode 100644 index 0000000..3772362 --- /dev/null +++ b/client/console/src/main/resources/org/apache/syncope/client/console/pages/Workflow.properties @@ -0,0 +1,17 @@ +# 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. +noActivitiEnabledForUsers=Activiti not enabled for users http://git-wip-us.apache.org/repos/asf/syncope/blob/3fc2f962/client/console/src/main/resources/org/apache/syncope/client/console/pages/Workflow_it.properties ---------------------------------------------------------------------- diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/Workflow_it.properties b/client/console/src/main/resources/org/apache/syncope/client/console/pages/Workflow_it.properties new file mode 100644 index 0000000..a4975e8 --- /dev/null +++ b/client/console/src/main/resources/org/apache/syncope/client/console/pages/Workflow_it.properties @@ -0,0 +1,17 @@ +# 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. +noActivitiEnabledForUsers=Activiti non configurato per gli utenti http://git-wip-us.apache.org/repos/asf/syncope/blob/3fc2f962/client/console/src/main/resources/org/apache/syncope/client/console/pages/Workflow_pt_BR.properties ---------------------------------------------------------------------- diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/Workflow_pt_BR.properties b/client/console/src/main/resources/org/apache/syncope/client/console/pages/Workflow_pt_BR.properties new file mode 100644 index 0000000..ea20be7 --- /dev/null +++ b/client/console/src/main/resources/org/apache/syncope/client/console/pages/Workflow_pt_BR.properties @@ -0,0 +1,17 @@ +# 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. +noActivitiEnabledForUsers=Activiti n\u00e3o habilitado para usu\u00e1rios
