@Test
public void hasOrganizationPermission_for_logged_in_user() {
OrganizationDto org = db.organizations().insert();
+ ComponentDto project = db.components().insertProject();
db.users().insertPermissionOnUser(org, userDto, GlobalPermissions.PROVISIONING);
+ db.users().insertProjectPermissionOnUser(org, userDto, UserRole.ADMIN, project);
UserSession session = newUserSession(userDto);
assertThat(session.hasOrganizationPermission(org.getUuid(), GlobalPermissions.PROVISIONING)).isTrue();
where
ur.organization_uuid=#{organizationUuid,jdbcType=VARCHAR} and
ur.user_id=#{userId,jdbcType=BIGINT}
+ and ur.resource_id is null
</select>
<select id="selectOrganizationPermissionsOfAnonymous" parameterType="map" resultType="string">
*/
@Test
public void selectOrganizationPermissions_for_logged_in_user() {
+ ComponentDto project = db.components().insertProject();
db.users().insertMember(group1, user);
db.users().insertPermissionOnUser(org, user, "perm1");
+ db.users().insertProjectPermissionOnUser(org, user, "perm42", project);
db.users().insertPermissionOnGroup(group1, "perm2");
db.users().insertPermissionOnAnyone(org, "perm3");