/** * @see org.opencastproject.security.api.User#hasRole(java.lang.String) */ @Override public boolean hasRole(String roleName) { for (Role role : roles) { if (role.getName().equals(roleName)) return true; } return false; }
/** * @see org.opencastproject.security.api.User#hasRole(String) */ @Override public boolean hasRole(String roleName) { for (Role role : roles) { if (role.getName().equals(roleName)) return true; } return false; }
protected boolean isUserAllowed(File aclFile) throws SAXException, IOException, XPathExpressionException { Document aclDoc = builder.parse(aclFile); XPath xPath = XPathFactory.newInstance().newXPath(); NodeList roles = (NodeList) xPath.evaluate("//*[local-name() = 'role']", aclDoc, XPathConstants.NODESET); for (int i = 0; i < roles.getLength(); i++) { Node role = roles.item(i); for (Role userRole : securityService.getUser().getRoles()) { if (userRole.getName().equals(role.getTextContent())) { return true; } } } return false; }
@Override public boolean equals(Object obj) { if (!(obj instanceof Role)) return false; Role other = (Role) obj; return name.equals(other.getName()) && organization.equals(other.getOrganization()); }
/** * {@inheritDoc} * * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object obj) { if (!(obj instanceof Role)) return false; Role other = (Role) obj; return name.equals(other.getName()) && organization.equals(other.getOrganization()); }
public static JaxbRole fromRole(Role role) { if (role instanceof JaxbRole) return (JaxbRole) role; JaxbOrganization org = JaxbOrganization.fromOrganization(role.getOrganization()); return new JaxbRole(role.getName(), org, role.getDescription(), role.getType()); }
if (!role.getName().equals(aceRole)) continue;