Example usage for org.springframework.security.web.authentication.switchuser SwitchUserFilter ROLE_PREVIOUS_ADMINISTRATOR

List of usage examples for org.springframework.security.web.authentication.switchuser SwitchUserFilter ROLE_PREVIOUS_ADMINISTRATOR

Introduction

In this page you can find the example usage for org.springframework.security.web.authentication.switchuser SwitchUserFilter ROLE_PREVIOUS_ADMINISTRATOR.

Prototype

String ROLE_PREVIOUS_ADMINISTRATOR

To view the source code for org.springframework.security.web.authentication.switchuser SwitchUserFilter ROLE_PREVIOUS_ADMINISTRATOR.

Click Source Link

Usage

From source file:mx.edu.um.mateo.general.utils.SpringSecurityUtils.java

/**
 * Check if the current user is switched to another user.
 * //w  ww .ja  v a 2  s.com
 * @return <code>true</code> if logged in and switched
 */
public boolean isSwitched() {
    return ifAllGranted(SwitchUserFilter.ROLE_PREVIOUS_ADMINISTRATOR);
}

From source file:org.codehaus.groovy.grails.plugins.springsecurity.SpringSecurityUtils.java

/**
 * Check if the current user is switched to another user.
 * @return <code>true</code> if logged in and switched
 *//* w  w  w  . ja  v  a 2s .c o  m*/
public static boolean isSwitched() {
    return ifAllGranted(SwitchUserFilter.ROLE_PREVIOUS_ADMINISTRATOR);
}

From source file:grails.plugin.springsecurity.SpringSecurityUtils.java

/**
 * Check if the current user is switched to another user.
 * @return <code>true</code> if logged in and switched
 *//*from  w ww .  ja va 2 s.c  om*/
public static boolean isSwitched() {
    Collection<? extends GrantedAuthority> inferred = findInferredAuthorities(getPrincipalAuthorities());
    for (GrantedAuthority authority : inferred) {
        if (authority instanceof SwitchUserGrantedAuthority) {
            return true;
        }
        if (SwitchUserFilter.ROLE_PREVIOUS_ADMINISTRATOR.equals(authority.getAuthority())) {
            return true;
        }
    }
    return false;
}