BrightSide Workbench Full Report + Source Code
AttachMenu.java
Go to the documentation of this file.
1 /*
2  * TurrĂ³ i Cutiller Foundation. License notice.
3  * Copyright (C) 2011 Lluis TurrĂ³ Cutiller <http://www.turro.org/>
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU Affero General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU Affero General Public License for more details.
14  *
15  * You should have received a copy of the GNU Affero General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 package org.turro.attach.zul.menu;
19 
20 import org.turro.annotation.ExternalMenu;
21 import org.turro.auth.Authentication;
22 import org.turro.menu.ElephantMenu;
23 import org.turro.menu.ElephantMenuBar;
24 import org.turro.menu.ElephantSubmenu;
25 import org.turro.security.Permission;
26 
32 public class AttachMenu extends ElephantMenu {
33 
34  @Override
35  public void addToMenu(ElephantMenuBar bar) {
36  bar.addMenu("Attachments", Permission.from("attach:root", "attach:self"))
37  .addSubmenu()
38  .addMenuitem("Attachments root", "clip", "/attachment/attachNavigatorRoot.zul", Permission.from("attach:root"))
39  .addMenuitem("Self attachments", "clip", "/attachment/attachNavigatorSelf.zul", Permission.from("attach:self"))
41  .addMenuitem("File root", "clip", "/attachment/fileNavigatorRoot.zul", Permission.from("file-attach:root"))
42  .addMenuitem("Self files", "clip", "/attachment/fileNavigatorSelf.zul", Permission.from("file-attach:self"))
44  .addMenuitem("Repository", "/attachment/repositories.zul", Permission.from("repository:new"))
46  .addMenuitem("Documentation definitions", "/attachment/docdefinitions.zul", Permission.from("file-attach:root"));
47  }
48 
49  @Override
50  public void addToSessionMenu(ElephantSubmenu submenu) {
51  submenu.addMenu("My documents", Permission.from("my-documents:list"))
52  .addSubmenu()
53  .addMenuitem("My documents", "folder_documents", "/attachment/myDocuments.zul")
54  .addMenuitem("My files", "folder_documents", "/attachment/myFiles.zul");
55  }
56 
57  @Override
58  public void addToToolsMenu(ElephantSubmenu submenu) {
59  submenu.addMenuitem("Web root", "/attachment/fileWebRoot.zul", Permission.from(() -> Authentication.isCloudAdmin()));
60  //.addMenuitem("System root", "/attachment/fileRoot.zul", Permission.from(() -> Authentication.isCloudAdmin()));
61  }
62 
63 }
void addToMenu(ElephantMenuBar bar)
Definition: AttachMenu.java:35
void addToSessionMenu(ElephantSubmenu submenu)
Definition: AttachMenu.java:50
void addToToolsMenu(ElephantSubmenu submenu)
Definition: AttachMenu.java:58
ElephantMenu addMenu(String label)
ElephantSubmenu addSubmenu()
ElephantMenu addMenu(String label)
ElephantSubmenu addMenuitem(String label, String include)
static Permission from(String... roles)
Definition: Permission.java:79