ItemPermissions entries = m_permissionsManager.getItemPermissions(entity);
// User permissions
for (UserPermission userEntry : entries.getUserPermissions()) {
UserId userId = userEntry.roleId;
Permissions permissions = userEntry.permissions;
List<CPermission> permissionList = m_userPermissions.get(userId);
if (permissionList == null) {
permissionList = Lists.newArrayList();
m_userPermissions.put(userId, permissionList);
}
permissionList.add(new CPermission(entity.getID().toString(), entity.getEntityType().getId(), permissions
.getAllowedBits(), permissions.getDeniedBits()));
}
// Group permissions
for (GroupPermission groupEntry : entries.getGroupPermissions()) {
GroupId groupId = groupEntry.roleId;
Permissions permissions = groupEntry.permissions;
List<CPermission> permissionList = m_userPermissions.get(groupId);
if (permissionList == null) {
permissionList = Lists.newArrayList();
m_userPermissions.put(groupId, permissionList);
}
permissionList.add(new CPermission(entity.getID().toString(), entity.getEntityType().getId(), permissions
.getAllowedBits(), permissions.getDeniedBits()));
}
}