Code example for Subject

Methods: doAsPrivileged

0
	public static void checkPermission(Permission permission) {
		FacesContext context = FacesContext.getCurrentInstance();
		Application application = context.getApplication();
		Subject subject = application.evaluateExpressionGet(context, "#{userBean.subject}", Subject.class);
		try { 
			Subject.doAsPrivileged(subject, new SimplePriviligedAction(permission), null);
		} catch (SecurityException e) {
			log.warn(e);
		} 
	} 
 
}