本文整理汇总了Java中org.kuali.rice.krad.util.GlobalVariables.getUserSession方法的典型用法代码示例。如果您正苦于以下问题:Java GlobalVariables.getUserSession方法的具体用法?Java GlobalVariables.getUserSession怎么用?Java GlobalVariables.getUserSession使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.kuali.rice.krad.util.GlobalVariables
的用法示例。
在下文中一共展示了GlobalVariables.getUserSession方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkViewAuthorization
import org.kuali.rice.krad.util.GlobalVariables; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void checkViewAuthorization(UifFormBase form) throws AuthorizationException {
// if user session or view not established we cannnot authorize the view request
View view = form.getView();
if ((GlobalVariables.getUserSession() == null) || view == null) {
return;
}
Person user = GlobalVariables.getUserSession().getPerson();
boolean viewAuthorized = view.getAuthorizer().canOpenView(view, form, user);
if (!viewAuthorized) {
throw new AuthorizationException(user.getPrincipalName(), "open", view.getId(),
"User '" + user.getPrincipalName() + "' is not authorized to open view ID: " +
view.getId(), null);
}
}
示例2: logout
import org.kuali.rice.krad.util.GlobalVariables; //导入方法依赖的package包/类
public ActionForward logout(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
LOG.debug("logout");
String forward = "viewPortal";
UserSession uSession = getUserSession(request);
if (uSession.isBackdoorInUse()) {
uSession.clearBackdoorUser();
setFormGroupPermission((BackdoorForm)form, request);
//request.setAttribute("reloadPage","true");
org.kuali.rice.krad.UserSession KnsUserSession;
KnsUserSession = GlobalVariables.getUserSession();
KnsUserSession.clearBackdoorUser();
}
else {
forward = "logout";
}
return mapping.findForward(forward);
}
示例3: logout
import org.kuali.rice.krad.util.GlobalVariables; //导入方法依赖的package包/类
@RequestMapping(params = "methodToCall=logout")
public ModelAndView logout(@ModelAttribute("KualiForm") UifFormBase form, HttpServletRequest request,
HttpServletResponse response) {
UserSession userSession = GlobalVariables.getUserSession();
if (userSession.isBackdoorInUse()) {
userSession.clearBackdoorUser();
}
request.getSession().invalidate();
return returnToHub(form);
}
示例4: retrieveEditModesAndActionFlags
import org.kuali.rice.krad.util.GlobalVariables; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void retrieveEditModesAndActionFlags() {
View view = ViewLifecycle.getView();
UifFormBase model = (UifFormBase) ViewLifecycle.getModel();
ViewPresentationController presentationController = view.getPresentationController();
ViewAuthorizer authorizer = view.getAuthorizer();
RequestAuthorizationCache requestAuthorizationCache;
try {
requestAuthorizationCache = view.getRequestAuthorizationCacheClass().newInstance();
} catch (Exception e) {
throw new RuntimeException("Cannot create instance of request authorization cache class", e);
}
presentationController.setRequestAuthorizationCache(requestAuthorizationCache);
authorizer.setRequestAuthorizationCache(requestAuthorizationCache);
Set<String> actionFlags = presentationController.getActionFlags(view, model);
Set<String> editModes = presentationController.getEditModes(view, model);
// if user session is not established cannot invoke authorizer
if (GlobalVariables.getUserSession() != null) {
Person user = GlobalVariables.getUserSession().getPerson();
actionFlags = authorizer.getActionFlags(view, model, user, actionFlags);
editModes = authorizer.getEditModes(view, model, user, editModes);
}
view.setActionFlags(new BooleanMap(actionFlags));
view.setEditModes(new BooleanMap(editModes));
}
示例5: generateNewLock
import org.kuali.rice.krad.util.GlobalVariables; //导入方法依赖的package包/类
/**
* @see org.kuali.rice.krad.service.PessimisticLockService#generateNewLock(java.lang.String, java.lang.String, org.kuali.rice.kim.api.identity.Person)
*/
@Override
public PessimisticLock generateNewLock(String documentNumber, String lockDescriptor, Person user) {
PessimisticLock lock = new PessimisticLock(documentNumber, lockDescriptor, user, GlobalVariables.getUserSession());
lock = save(lock);
if ( LOG.isDebugEnabled() ) {
LOG.debug("Generated new lock: " + lock);
}
return lock;
}
示例6: isSuppressName
import org.kuali.rice.krad.util.GlobalVariables; //导入方法依赖的package包/类
public static boolean isSuppressName(String entityId) {
EntityPrivacyPreferences privacy = getIdentityService().getEntityPrivacyPreferences(entityId);
if (privacy == null) {
return false; // no privacy preferences, assume unset
}
UserSession userSession = GlobalVariables.getUserSession();
boolean suppressName = privacy.isSuppressName();
return suppressName
&& userSession != null
&& !StringUtils.equals(userSession.getPerson().getEntityId(), entityId)
&& !canOverrideEntityPrivacyPreferences(entityId);
}
示例7: isSuppressEmail
import org.kuali.rice.krad.util.GlobalVariables; //导入方法依赖的package包/类
public static boolean isSuppressEmail(String entityId) {
EntityPrivacyPreferences privacy = getIdentityService().getEntityPrivacyPreferences(entityId);
if (privacy == null) {
return false; // no privacy preferences, assume unset
}
UserSession userSession = GlobalVariables.getUserSession();
boolean suppressEmail = privacy.isSuppressEmail();
return suppressEmail
&& userSession != null
&& !StringUtils.equals(userSession.getPerson().getEntityId(), entityId)
&& !canOverrideEntityPrivacyPreferences(entityId);
}
示例8: isSuppressPhone
import org.kuali.rice.krad.util.GlobalVariables; //导入方法依赖的package包/类
public static boolean isSuppressPhone(String entityId) {
EntityPrivacyPreferences privacy = getIdentityService().getEntityPrivacyPreferences(entityId);
if (privacy == null) {
return false; // no privacy preferences, assume unset
}
UserSession userSession = GlobalVariables.getUserSession();
boolean suppressPhone = privacy.isSuppressPhone();
return suppressPhone
&& userSession != null
&& !StringUtils.equals(userSession.getPerson().getEntityId(), entityId)
&& !canOverrideEntityPrivacyPreferences(entityId);
}
示例9: isUserInitiator
import org.kuali.rice.krad.util.GlobalVariables; //导入方法依赖的package包/类
public static boolean isUserInitiator(String id) throws WorkflowException {
boolean initiator = false;
UserSession userSession = GlobalVariables.getUserSession();
if (userSession != null) {
try {
String documentId = id.trim();
if (userSession.getPrincipalId().equals(KewApiServiceLocator.getWorkflowDocumentService().getDocument(documentId).getInitiatorPrincipalId())) {
initiator = true;
}
} catch (Exception e) {
LOG.debug("Exception encountered trying to determine if user is the document initiator:" + e );
}
}
return initiator;
}
示例10: getUserSession
import org.kuali.rice.krad.util.GlobalVariables; //导入方法依赖的package包/类
private static UserSession getUserSession() {
return GlobalVariables.getUserSession();
}
示例11: getAuthenticatedPerson
import org.kuali.rice.krad.util.GlobalVariables; //导入方法依赖的package包/类
public static Person getAuthenticatedPerson(){
UserSession userSession=GlobalVariables.getUserSession();
Person user = userSession.getPerson();
return user;
}
示例12: getUserSession
import org.kuali.rice.krad.util.GlobalVariables; //导入方法依赖的package包/类
private UserSession getUserSession(){
return GlobalVariables.getUserSession();
}
示例13: Visibility
import org.kuali.rice.krad.util.GlobalVariables; //导入方法依赖的package包/类
Visibility(XPath xpath, Node n) throws XPathExpressionException {
Boolean visible = null;
String type = null;
String groupName = null;
String groupNamespace = null;
Node node = (Node) xpath.evaluate("(visibility/field | visibility/column | visibility/fieldAndColumn)", n, XPathConstants.NODE); // NODE - just use first one
if (node != null && node instanceof Element) {
Element visibilityEl = (Element) node;
type = visibilityEl.getNodeName();
Attr attr = visibilityEl.getAttributeNode("visible");
if (attr != null) {
visible = Boolean.valueOf(attr.getValue());
}
Node groupMember = (Node) xpath.evaluate("(" + XmlConstants.IS_MEMBER_OF_GROUP + "|" + XmlConstants.IS_MEMBER_OF_WORKGROUP + ")", visibilityEl, XPathConstants.NODE);
if (groupMember != null && groupMember instanceof Element) {
Element groupMemberEl = (Element) groupMember;
boolean group_def_found = false;
if (XmlConstants.IS_MEMBER_OF_GROUP.equals(groupMember.getNodeName())) {
group_def_found = true;
groupName = Utilities.substituteConfigParameters(groupMember.getTextContent().trim());
groupNamespace = Utilities.substituteConfigParameters(groupMemberEl.getAttribute(XmlConstants.NAMESPACE)).trim();
} else if (XmlConstants.IS_MEMBER_OF_WORKGROUP.equals(groupMember.getNodeName())) {
group_def_found = true;
LOG.warn("Rule Attribute XML is using deprecated element '" + XmlConstants.IS_MEMBER_OF_WORKGROUP +
"', please use '" + XmlConstants.IS_MEMBER_OF_GROUP + "' instead.");
String workgroupName = Utilities.substituteConfigParameters(groupMember.getTextContent());
groupNamespace = Utilities.parseGroupNamespaceCode(workgroupName);
groupName = Utilities.parseGroupName(workgroupName);
}
if (group_def_found) {
if (StringUtils.isEmpty(groupName) || StringUtils.isEmpty(groupNamespace)) {
throw new RuntimeException("Both group name and group namespace must be present for group-based visibility.");
}
GroupService groupService = KimApiServiceLocator.getGroupService();
Group group = groupService.getGroupByNamespaceCodeAndName(groupNamespace, groupName);
UserSession session = GlobalVariables.getUserSession();
if (session != null) {
visible = group == null ? false : groupService.isMemberOfGroup(session.getPerson().getPrincipalId(), group.getId());
}
}
}
}
this.visible = visible;
this.type = type;
this.groupName = groupName;
this.groupNamespace = groupNamespace;
}
示例14: getUserSession
import org.kuali.rice.krad.util.GlobalVariables; //导入方法依赖的package包/类
public static UserSession getUserSession(HttpServletRequest request) {
return GlobalVariables.getUserSession();
}
示例15: getUserSession
import org.kuali.rice.krad.util.GlobalVariables; //导入方法依赖的package包/类
private UserSession getUserSession() {
return GlobalVariables.getUserSession();
}