[AAA-54] Grant Creation is Broken Created: 22/Jul/15  Updated: 21/Mar/19  Resolved: 23/Aug/15

Status: Resolved
Project: aaa
Component/s: General
Affects Version/s: None
Fix Version/s: None

Type: Bug
Reporter: Ryan Goulding Assignee: Ryan Goulding
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: All
Platform: All


External issue ID: 4038

 Description   

curl -u admin:admin -X POST -H "Content-type: application/json" --data-binary @./grant.json http://localhost:8181/auth/v1/domains/1/users/3/roles

{"message":"Internal error creating grant","details":"SQL Exception : org.h2.jdbc.JdbcSQLException: Parameter \"#2\" is not set; SQL statement:\nSELECT * FROM GRANTS WHERE domainid = ? AND userid = ? AND roleid = ? [90012-185]"}

This is caused in DomainHandler.getGrant(int did,int uid,int rid):
PreparedStatement pstmt = conn.prepareStatement("SELECT * FROM GRANTS WHERE domainid = ? AND userid = ? AND roleid = ? ");
pstmt.setInt(1, did);
pstmt.setInt(1, uid);
pstmt.setInt(1, rid);

Should be:
pstmt.setInt(1, did);
pstmt.setInt(2, uid);
pstmt.setInt(3, rid);



 Comments   
Comment by Ryan Goulding [ 23/Aug/15 ]

Be: https://git.opendaylight.org/gerrit/#/c/24401/

Cherry picked back to Li & He:
Li: https://git.opendaylight.org/gerrit/#/c/24402/
He: https://git.opendaylight.org/gerrit/#/c/24539/

Generated at Wed Feb 07 19:08:31 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.