KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > infoglue > cms > applications > managementtool > actions > ViewSystemUserAction


1 /* ===============================================================================
2  *
3  * Part of the InfoGlue Content Management Platform (www.infoglue.org)
4  *
5  * ===============================================================================
6  *
7  * Copyright (C)
8  *
9  * This program is free software; you can redistribute it and/or modify it under
10  * the terms of the GNU General Public License version 2, as published by the
11  * Free Software Foundation. See the file LICENSE.html for more information.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY, including the implied warranty of MERCHANTABILITY or FITNESS
15  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License along with
18  * this program; if not, write to the Free Software Foundation, Inc. / 59 Temple
19  * Place, Suite 330 / Boston, MA 02111-1307 / USA.
20  *
21  * ===============================================================================
22  */

23
24 package org.infoglue.cms.applications.managementtool.actions;
25
26 import java.util.ArrayList JavaDoc;
27 import java.util.List JavaDoc;
28
29 import org.infoglue.cms.applications.common.actions.InfoGlueAbstractAction;
30 import org.infoglue.cms.controllers.kernel.impl.simple.ContentTypeDefinitionController;
31 import org.infoglue.cms.controllers.kernel.impl.simple.GroupControllerProxy;
32 import org.infoglue.cms.controllers.kernel.impl.simple.RoleControllerProxy;
33 import org.infoglue.cms.controllers.kernel.impl.simple.UserControllerProxy;
34 import org.infoglue.cms.controllers.kernel.impl.simple.UserPropertiesController;
35 import org.infoglue.cms.entities.management.ContentTypeDefinitionVO;
36 import org.infoglue.cms.security.InfoGluePrincipal;
37
38 public class ViewSystemUserAction extends InfoGlueAbstractAction
39 {
40     private static final long serialVersionUID = 1L;
41
42     private String JavaDoc userName;
43     private boolean supportsUpdate = true;
44     private InfoGluePrincipal infoGluePrincipal;
45     private List JavaDoc roles = new ArrayList JavaDoc();
46     private List JavaDoc assignedRoleVOList;
47     private List JavaDoc groups = new ArrayList JavaDoc();
48     private List JavaDoc assignedGroupVOList;
49     private List JavaDoc contentTypeDefinitionVOList;
50     private List JavaDoc assignedContentTypeDefinitionVOList;
51     
52     protected void initialize(String JavaDoc userName) throws Exception JavaDoc
53     {
54         //this.supportsUpdate = UserControllerProxy.getController().getSupportUpdate();
55
this.infoGluePrincipal = UserControllerProxy.getController().getUser(userName);
56         this.supportsUpdate = this.infoGluePrincipal.getAutorizationModule().getSupportUpdate();
57         
58         this.assignedRoleVOList = infoGluePrincipal.getRoles();
59         if(this.supportsUpdate) //Only fetch if the user can edit.
60
this.roles = this.infoGluePrincipal.getAutorizationModule().getRoles();
61         
62         this.assignedGroupVOList = infoGluePrincipal.getGroups();
63         if(this.supportsUpdate) //Only fetch if the user can edit.
64
this.groups = this.infoGluePrincipal.getAutorizationModule().getGroups();
65         
66         this.contentTypeDefinitionVOList = ContentTypeDefinitionController.getController().getContentTypeDefinitionVOList(ContentTypeDefinitionVO.EXTRANET_USER_PROPERTIES);
67         this.assignedContentTypeDefinitionVOList = UserPropertiesController.getController().getContentTypeDefinitionVOList(userName);
68     }
69
70     public String JavaDoc doExecute() throws Exception JavaDoc
71     {
72         this.initialize(getUserName());
73         
74         return "success";
75     }
76         
77     public List JavaDoc getAssignedRoles() throws Exception JavaDoc
78     {
79         return this.assignedRoleVOList;
80     }
81
82     public List JavaDoc getAllRoles() throws Exception JavaDoc
83     {
84         return this.roles;
85     }
86
87     public List JavaDoc getAssignedGroups() throws Exception JavaDoc
88     {
89         return this.assignedGroupVOList;
90     }
91
92     public List JavaDoc getAllGroups() throws Exception JavaDoc
93     {
94         return this.groups;
95     }
96     
97     public List JavaDoc getContentTypeDefinitionVOList()
98     {
99         return contentTypeDefinitionVOList;
100     }
101
102     public String JavaDoc getUserName()
103     {
104         return this.userName;
105     }
106
107     public void setUserName(String JavaDoc userName)
108     {
109         this.userName = userName;
110     }
111
112     public String JavaDoc getFirstName()
113     {
114         return infoGluePrincipal.getFirstName();
115     }
116     
117     public String JavaDoc getLastName()
118     {
119         return infoGluePrincipal.getLastName();
120     }
121
122     public String JavaDoc getEmail()
123     {
124         return infoGluePrincipal.getEmail();
125     }
126     
127     public boolean getSupportsUpdate()
128     {
129         return this.supportsUpdate;
130     }
131         
132     public List JavaDoc getAssignedContentTypeDefinitionVOList()
133     {
134         return assignedContentTypeDefinitionVOList;
135     }
136
137 }
138
Popular Tags