[DEV] update and correct test
This commit is contained in:
parent
00295b94d1
commit
5256278219
@ -44,8 +44,17 @@ public class RightResource {
|
|||||||
logger.debug("Get some descriptions: {} applicationId={}", rightsDescriptions.size(), applicationId);
|
logger.debug("Get some descriptions: {} applicationId={}", rightsDescriptions.size(), applicationId);
|
||||||
if (rightsDescriptions != null && rightsDescriptions.size() != 0) {
|
if (rightsDescriptions != null && rightsDescriptions.size() != 0) {
|
||||||
final List<Right> rights = getRawUserRight(userId, applicationId);
|
final List<Right> rights = getRawUserRight(userId, applicationId);
|
||||||
logger.debug("Get some user right: {}userID={}", rights.size(), userId);
|
logger.debug("Get some user right: count={} userID={}", rights.size(), userId);
|
||||||
|
logger.debug("Rights:");
|
||||||
|
for (final Right elem : rights) {
|
||||||
|
logger.debug(" - applId={} rightDescriptionId={} value={}", elem.applicationId, elem.rightDescriptionId, elem.value);
|
||||||
|
}
|
||||||
|
logger.debug("RightDescription:");
|
||||||
|
for (final RightDescription elem : rightsDescriptions) {
|
||||||
|
logger.debug(" - id={} key={} type={} default={}", elem.id, elem.key, elem.type, elem.defaultValue);
|
||||||
|
}
|
||||||
for (final RightDescription description : rightsDescriptions) {
|
for (final RightDescription description : rightsDescriptions) {
|
||||||
|
|
||||||
if (description == null) {
|
if (description == null) {
|
||||||
// TODO: this is a really strange case to manage later...
|
// TODO: this is a really strange case to manage later...
|
||||||
continue;
|
continue;
|
||||||
|
@ -47,29 +47,29 @@ public class Initialization extends MigrationSqlStep {
|
|||||||
('EMAIL_VALIDATION_REQUIRED', 'rwr-r-', 'BOOLEAN', 'false');
|
('EMAIL_VALIDATION_REQUIRED', 'rwr-r-', 'BOOLEAN', 'false');
|
||||||
""");
|
""");
|
||||||
addAction("""
|
addAction("""
|
||||||
INSERT INTO `rightDescription` (`id`, `applicationId`, `key`, `title`, `description`, `type`) VALUES
|
INSERT INTO `rightDescription` (`id`, `applicationId`, `key`, `title`, `description`, `type`, `defaultValue`) VALUES
|
||||||
(1, 1, 'ADMIN', 'Administrator', 'Full administrator Right', 'BOOLEAN');
|
(1, 1, 'ADMIN', 'Administrator', 'Full administrator Right', 'BOOLEAN', 'false');
|
||||||
""");
|
""");
|
||||||
addAction("""
|
addAction("""
|
||||||
INSERT INTO `right` (`applicationId`, `userId`, `rightDescriptionId`, `value`) VALUES
|
INSERT INTO `right` (`applicationId`, `userId`, `rightDescriptionId`, `value`) VALUES
|
||||||
(1, 1, 1, 'true');
|
(1, 1, 1, 'true');
|
||||||
""");
|
""");
|
||||||
// we generate an offset to permit to manage some generic upgrade in the future...
|
// we generate an offset to permit to manage some generic upgrade in the future... (can not be done in sqlite)
|
||||||
addAction("""
|
addAction("""
|
||||||
ALTER TABLE `application` AUTO_INCREMENT = 1000;
|
ALTER TABLE `application` AUTO_INCREMENT = 1000;
|
||||||
""");
|
""", "mysql");
|
||||||
addAction("""
|
addAction("""
|
||||||
ALTER TABLE `user` AUTO_INCREMENT = 1000;
|
ALTER TABLE `user` AUTO_INCREMENT = 1000;
|
||||||
""");
|
""", "mysql");
|
||||||
addAction("""
|
addAction("""
|
||||||
ALTER TABLE `settings` AUTO_INCREMENT = 1000;
|
ALTER TABLE `settings` AUTO_INCREMENT = 1000;
|
||||||
""");
|
""", "mysql");
|
||||||
addAction("""
|
addAction("""
|
||||||
ALTER TABLE `right` AUTO_INCREMENT = 1000;
|
ALTER TABLE `right` AUTO_INCREMENT = 1000;
|
||||||
""");
|
""", "mysql");
|
||||||
addAction("""
|
addAction("""
|
||||||
ALTER TABLE `rightDescription` AUTO_INCREMENT = 1000;
|
ALTER TABLE `rightDescription` AUTO_INCREMENT = 1000;
|
||||||
""");
|
""", "mysql");
|
||||||
display();
|
display();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ public class TestBase {
|
|||||||
// check userID
|
// check userID
|
||||||
final String userUID = ret.getSubject();
|
final String userUID = ret.getSubject();
|
||||||
final long id = Long.parseLong(userUID);
|
final long id = Long.parseLong(userUID);
|
||||||
Assertions.assertEquals(0, id);
|
Assertions.assertEquals(1, id);
|
||||||
final String name = (String) ret.getClaim("login");
|
final String name = (String) ret.getClaim("login");
|
||||||
Assertions.assertEquals("karadmin", name);
|
Assertions.assertEquals("karadmin", name);
|
||||||
|
|
||||||
@ -248,7 +248,7 @@ public class TestBase {
|
|||||||
public void testMeWithToken() throws Exception {
|
public void testMeWithToken() throws Exception {
|
||||||
loginAdmin();
|
loginAdmin();
|
||||||
final String result = api.get(String.class, "users/me");
|
final String result = api.get(String.class, "users/me");
|
||||||
Assertions.assertEquals("{\"id\":0,\"login\":\"karadmin\"}", result);
|
Assertions.assertEquals("{\"id\":1,\"login\":\"karadmin\"}", result);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user