/** * Returns whether or not to require that the user have all of the privileges in order to be * "authorized" for this method * * @param method * @return boolean true/false whether to "and" privileges together * @see org.openmrs.annotation.Authorized#requireAll() */ public boolean getRequireAll(Method method) { for (Annotation annotation : method.getAnnotations()) { // check for Secured annotations if (annotation instanceof Authorized) { Authorized attr = (Authorized) annotation; return attr.requireAll(); } } return false; }
/** * Get the <code>Secured</code> attributes for a given target class. * * @param target The target method * @return Collection of <code>SecurityConfig</code> * @see Attributes#getAttributes */ public Collection getAttributes(Class target) { Set<String> attributes = new HashSet<String>(); for (Annotation annotation : target.getAnnotations()) { // check for Secured annotations if (annotation instanceof Authorized) { Authorized attr = (Authorized) annotation; for (String privilege : attr.value()) { attributes.add(privilege); } break; } } return attributes; }