All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.sonar.db.user.RoleMapper.xml Maven / Gradle / Ivy

The newest version!
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd">

<mapper namespace="org.sonar.db.user.RoleMapper">

  <select id="selectComponentIdsByPermissionAndUserId" parameterType="map" resultType="long">
    select
      ur.resource_id
    from
      user_roles ur
    where
      ur.user_id = #{userId,jdbcType=INTEGER}
      and ur.role = #{permission,jdbcType=VARCHAR}
      and ur.resource_id is not null
    union
    select
      gr.resource_id
    from
      group_roles gr
    inner join groups_users gu on
      gr.group_id=gu.group_id
    where
      gr.role = #{permission,jdbcType=VARCHAR}
      and gr.resource_id is not null
      and gu.user_id=#{userId,jdbcType=INTEGER}
    order by
      resource_id
  </select>

  <delete id="deleteGroupRolesByGroupId" parameterType="int">
    delete from
      group_roles
    where
      group_id=#{id,jdbcType=INTEGER}
  </delete>
</mapper>




© 2015 - 2024 Weber Informatics LLC | Privacy Policy