use of org.apache.shiro.authz.Permission in project graylog2-server by Graylog2.
the class RootAccountRealm method addRootAccount.
private void addRootAccount(String username, String password) {
LOG.debug("Adding root account named {}, having all permissions", username);
add(new SimpleAccount(username, password, getName(), CollectionUtils.asSet("root"), CollectionUtils.<Permission>asSet(new AllPermission())));
}
use of org.apache.shiro.authz.Permission in project graylog2-server by Graylog2.
the class UserServiceImpl method getPermissionsForUser.
@Override
public List<Permission> getPermissionsForUser(User user) {
final GRN principal = grnRegistry.ofUser(user);
final ImmutableSet.Builder<Permission> permSet = ImmutableSet.<Permission>builder().addAll(user.getPermissions().stream().map(CaseSensitiveWildcardPermission::new).collect(Collectors.toSet())).addAll(permissionAndRoleResolver.resolvePermissionsForPrincipal(principal)).addAll(getUserPermissionsFromRoles(user).stream().map(CaseSensitiveWildcardPermission::new).collect(Collectors.toSet()));
return permSet.build().asList();
}
Aggregations