Last change
on this file since 27077 was 27077, checked in by sjm84, 11 years ago |
Added groups to the usercontext (and some minor reformatting)
|
-
Property svn:executable
set to
*
|
File size:
1.1 KB
|
Line | |
---|
1 | package org.greenstone.gsdl3.util;
|
---|
2 |
|
---|
3 | import org.w3c.dom.Element;
|
---|
4 |
|
---|
5 | public class UserContext
|
---|
6 | {
|
---|
7 | protected String _userID = null;
|
---|
8 | protected String _lang = null;
|
---|
9 | protected String[] _groups = null;
|
---|
10 |
|
---|
11 | public UserContext()
|
---|
12 | {
|
---|
13 | }
|
---|
14 |
|
---|
15 | public UserContext(Element xmlRequest)
|
---|
16 | {
|
---|
17 | _lang = xmlRequest.getAttribute(GSXML.LANG_ATT);
|
---|
18 | _userID = xmlRequest.getAttribute(GSXML.USER_ID_ATT);
|
---|
19 | _groups = xmlRequest.getAttribute(GSXML.GROUPS_ATT).split(",");
|
---|
20 | }
|
---|
21 |
|
---|
22 | public UserContext(String lang, String userID, String[] groups)
|
---|
23 | {
|
---|
24 | _lang = lang;
|
---|
25 | _userID = userID;
|
---|
26 | _groups = groups;
|
---|
27 | }
|
---|
28 |
|
---|
29 | public void setLanguage(String lang)
|
---|
30 | {
|
---|
31 | _lang = lang;
|
---|
32 | }
|
---|
33 |
|
---|
34 | public void setUserID(String userID)
|
---|
35 | {
|
---|
36 | _userID = userID;
|
---|
37 | }
|
---|
38 |
|
---|
39 | public void setGroups(String[] groups)
|
---|
40 | {
|
---|
41 | _groups = groups;
|
---|
42 | }
|
---|
43 |
|
---|
44 | public String getLanguage()
|
---|
45 | {
|
---|
46 | if (_lang != null)
|
---|
47 | {
|
---|
48 | return _lang;
|
---|
49 | }
|
---|
50 | return "";
|
---|
51 | }
|
---|
52 |
|
---|
53 | public String getUserID()
|
---|
54 | {
|
---|
55 | if (_userID != null)
|
---|
56 | {
|
---|
57 | return _userID;
|
---|
58 | }
|
---|
59 | return "";
|
---|
60 | }
|
---|
61 |
|
---|
62 | public String[] getGroups()
|
---|
63 | {
|
---|
64 | if (_groups != null)
|
---|
65 | {
|
---|
66 | return _groups;
|
---|
67 | }
|
---|
68 | return new String[0];
|
---|
69 | }
|
---|
70 | } |
---|
Note:
See
TracBrowser
for help on using the repository browser.