[BugFix:
add resourceVO and accountresourceref
@@ -374,8 +374,20 @@ DROP PROCEDURE IF EXISTS insertIAM2ProjectRole;
ALTER TABLE RolePolicyStatementVO ADD INDEX (`roleUuid`);
+DELIMITER $$
+CREATE PROCEDURE insertIntoRole(OUT num bigint(20) unsigned)
+ BEGIN
+ SELECT count(*) INTO num from RoleVO where type = 'System' and name like 'read-api-role-%';
+ if num > 0 THEN
insert into RoleVO(uuid, name, state, type, createDate, lastOpDate) values ('86d67c89dfe64b3ba67ecffd34cee418', 'read-api-role-default', 'Enabled', 'System', NOW(), NOW());
+ INSERT INTO ResourceVO (`uuid`, `resourceName`, `resourceType`) VALUES ('86d67c89dfe64b3ba67ecffd34cee418', 'read-api-role-default', 'RoleVO');
+ INSERT INTO AccountResourceRefVO (`accountUuid`, `ownerAccountUuid`, `resourceUuid`, `resourceType`, `permission`, `isShared`, `lastOpDate`, `createDate`, `concreteResourceType`) values ('36c27e8ff05c4780bf6d2fa65700f22e', '36c27e8ff05c4780bf6d2fa65700f22e', '86d67c89dfe64b3ba67ecffd34cee418', 'RoleVO', 2, 0, CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP(), 'org.zstack.header.identity.role.RoleVO');
insert into RolePolicyStatementVO(uuid, statement, roleUuid, createDate, lastOpDate) values ('7d800a63539b47e2cec86529cef3cd2d', '', '86d67c89dfe64b3ba67ecffd34cee418', NOW(), NOW());
+ END IF;
+ END $$
+DELIMITER ;
+
+DROP PROCEDURE IF EXISTS insertIntoRole;
DELIMITER $$
