wayf-dk / janus-ssp

Automatically exported from code.google.com/p/janus-ssp
Other
0 stars 0 forks source link

Wrong entityID displayed if metadata field is missing when exporting metadata #288

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create an entity an fill in metadata
2. Move to production state
3. Move back to test
4. Change entityID
5. Remove a required metadata field
6. Promote entity to production state
7. Try exporting metadata for the entity

What is the expected output? What do you see instead? If possible, please
give an URL the page with the defect.

I would expect that an erro message saying that the new entityID is missing a 
metadata field. Instead the original entityId is presented and an error message 
saying the the metadata field is missing

What version of the product are you using?

JANUS version: 1.10.0
SimpleSAMLphp version: 1.7.0
Browser: Chrome
PHP version: 5.2.3
Database version: MySQL 5.1.41
OS: Ubuntu 10.04

Please provide any additional information below:

The problem is the query in AdminUtil->getEntitiesByStateType() returns the 
wrong entityID:

Current query:

'SELECT DISTINCT `eid`, `entityid`, MAX(`revisionid`) AS `revisionid`,
                `created`
            FROM `'. self::$prefix .'entity` WHERE ' . implode(' AND ', $sql) . '
            GROUP BY `eid`;

This query return the correct eid/revisionid combination, but for som reason 
the wrong entityID is selected.

The following query should fix this problem.

SELECT T.`eid`, T.`entityid`, T.`revisionid`, T.`created` 
FROM `janus__entity` AS T, 
(SELECT `eid`, `entityid`, MAX(`revisionid`) AS `revisionid`, `created` 
FROM `janus__entity` 
WHERE `state` = 'prod' AND `type` IN ('saml20-idp')
GROUP BY `eid`
) AS M
WHERE T.`revisionid` = M.`revisionid` AND T.`eid` = M.`eid`;

Original issue reported on code.google.com by j...@wayf.dk on 27 Oct 2011 at 11:39

GoogleCodeExporter commented 9 years ago

Original comment by j...@wayf.dk on 3 Feb 2012 at 2:06

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r1022.

Original comment by j...@wayf.dk on 27 Apr 2012 at 7:06