Changeset 33711


Ignore:
Timestamp:
2019-11-21T14:20:57+13:00 (4 years ago)
Author:
kjdon
Message:

added editEnabled into UserContext

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/UserContext.java

    r27617 r33711  
    33import org.w3c.dom.Element;
    44import org.w3c.dom.NodeList;
     5import org.apache.commons.lang3.StringUtils;
    56
    67public class UserContext
     
    1011    protected String _lang = null;
    1112    protected String[] _groups = null;
     13    protected String _editEnabled = null;
    1214
    1315    public UserContext()
     
    2628            _lang = userContext.getAttribute(GSXML.LANG_ATT);
    2729            _groups = userContext.getAttribute(GSXML.GROUPS_ATT).split(",");
     30            _editEnabled = userContext.getAttribute(GSXML.EDIT_ENABLED_ATT);
    2831        }
    2932    }
    3033
    31     public UserContext(String lang, String username, String userID, String[] groups)
     34    public UserContext(String lang, String username, String userID, String[] groups, String editEnabled)
    3235    {
    3336        _userID = userID;
     
    3538        _lang = lang;
    3639        _groups = groups;
     40        _editEnabled = editEnabled;
    3741    }
    3842
     
    5761    }
    5862
     63    public void setEditEnabled(String editEnabled)
     64    {
     65    _editEnabled = editEnabled;
     66    }
     67   
    5968    public String getLanguage()
    6069    {
     
    92101        return new String[0];
    93102    }
     103    public String getGroupsString()
     104    {
     105    if (_groups != null)
     106    {
     107        return StringUtils.join(_groups, ",");
     108    }
     109    return "";
     110    }
     111   
     112    public String getEditEnabled()
     113    {
     114    if (_editEnabled != null) {
     115        return _editEnabled;
     116    }
     117    return "false";
     118    }
    94119}
Note: See TracChangeset for help on using the changeset viewer.