diff --git a/src/main/java/org/olat/ldap/_spring/ldapContext.xml b/src/main/java/org/olat/ldap/_spring/ldapContext.xml index 6822bc1150389c06388ceaad6c82d6b574f1e2d6..5086bcc84d2d1ebb4dbe83159073dbb58b7f5ecc 100644 --- a/src/main/java/org/olat/ldap/_spring/ldapContext.xml +++ b/src/main/java/org/olat/ldap/_spring/ldapContext.xml @@ -125,6 +125,16 @@ <entry key='${ldap.attrib.gen.map.ldapkey8}' value='${ldap.attrib.gen.map.olatkey8}' /> <entry key='${ldap.attrib.gen.map.ldapkey9}' value='${ldap.attrib.gen.map.olatkey9}' /> <entry key='${ldap.attrib.gen.map.ldapkey10}' value='${ldap.attrib.gen.map.olatkey10}' /> + <entry key='${ldap.attrib.gen.map.ldapkey11}' value='${ldap.attrib.gen.map.olatkey11}' /> + <entry key='${ldap.attrib.gen.map.ldapkey12}' value='${ldap.attrib.gen.map.olatkey12}' /> + <entry key='${ldap.attrib.gen.map.ldapkey13}' value='${ldap.attrib.gen.map.olatkey13}' /> + <entry key='${ldap.attrib.gen.map.ldapkey14}' value='${ldap.attrib.gen.map.olatkey14}' /> + <entry key='${ldap.attrib.gen.map.ldapkey15}' value='${ldap.attrib.gen.map.olatkey15}' /> + <entry key='${ldap.attrib.gen.map.ldapkey16}' value='${ldap.attrib.gen.map.olatkey16}' /> + <entry key='${ldap.attrib.gen.map.ldapkey17}' value='${ldap.attrib.gen.map.olatkey17}' /> + <entry key='${ldap.attrib.gen.map.ldapkey18}' value='${ldap.attrib.gen.map.olatkey18}' /> + <entry key='${ldap.attrib.gen.map.ldapkey19}' value='${ldap.attrib.gen.map.olatkey19}' /> + <entry key='${ldap.attrib.gen.map.ldapkey20}' value='${ldap.attrib.gen.map.olatkey20}' /> </map> </property> diff --git a/src/main/resources/database/mysql/refreshViews.sql b/src/main/resources/database/mysql/refreshViews.sql new file mode 100644 index 0000000000000000000000000000000000000000..236663c1d2f7163e4ed2a0671b0f250c48dfe466 --- /dev/null +++ b/src/main/resources/database/mysql/refreshViews.sql @@ -0,0 +1,336 @@ +-- user view +create or replace view o_bs_identity_short_v as ( + select + ident.id as id_id, + ident.name as id_name, + ident.lastlogin as id_lastlogin, + ident.status as id_status, + us.user_id as us_id, + p_firstname.propvalue as first_name, + p_lastname.propvalue as last_name, + p_email.propvalue as email + from o_bs_identity as ident + inner join o_user as us on (ident.fk_user_id = us.user_id) + left join o_userproperty as p_firstname on (us.user_id = p_firstname.fk_user_id and p_firstname.propName = 'firstName') + left join o_userproperty as p_lastname on (us.user_id = p_lastname.fk_user_id and p_lastname.propName = 'lastName') + left join o_userproperty as p_email on (us.user_id = p_email.fk_user_id and p_email.propName = 'email') +); + +-- eportfolio views +create or replace view o_ep_notifications_struct_v as ( + select + struct.structure_id as struct_id, + struct.structure_type as struct_type, + struct.title as struct_title, + struct.fk_struct_root_id as struct_root_id, + struct.fk_struct_root_map_id as struct_root_map_id, + (case when struct.structure_type = 'page' then struct.structure_id else parent_struct.structure_id end) as page_key, + struct_link.creationdate as creation_date + from o_ep_struct_el as struct + inner join o_ep_struct_struct_link as struct_link on (struct_link.fk_struct_child_id = struct.structure_id) + inner join o_ep_struct_el as parent_struct on (struct_link.fk_struct_parent_id = parent_struct.structure_id) + where struct.structure_type = 'page' or parent_struct.structure_type = 'page' +); + +create or replace view o_ep_notifications_art_v as ( + select + artefact.artefact_id as artefact_id, + artefact_link.link_id as link_id, + artefact.title as artefact_title, + (case when struct.structure_type = 'page' then struct.title else root_struct.title end ) as struct_title, + struct.structure_type as struct_type, + struct.structure_id as struct_id, + root_struct.structure_id as struct_root_id, + root_struct.structure_type as struct_root_type, + struct.fk_struct_root_map_id as struct_root_map_id, + (case when struct.structure_type = 'page' then struct.structure_id else root_struct.structure_id end ) as page_key, + artefact_link.fk_auth_id as author_id, + artefact_link.creationdate as creation_date + from o_ep_struct_el as struct + inner join o_ep_struct_artefact_link as artefact_link on (artefact_link.fk_struct_id = struct.structure_id) + inner join o_ep_artefact as artefact on (artefact_link.fk_artefact_id = artefact.artefact_id) + left join o_ep_struct_el as root_struct on (struct.fk_struct_root_id = root_struct.structure_id) +); + +create or replace view o_ep_notifications_rating_v as ( + select + urating.rating_id as rating_id, + map.structure_id as map_id, + map.title as map_title, + cast(urating.ressubpath as unsigned) as page_key, + page.title as page_title, + urating.creator_id as author_id, + urating.creationdate as creation_date, + urating.lastmodified as last_modified + from o_userrating as urating + inner join o_olatresource as rating_resource on (rating_resource.resid = urating.resid and rating_resource.resname = urating.resname) + inner join o_ep_struct_el as map on (map.fk_olatresource = rating_resource.resource_id) + left join o_ep_struct_el as page on (page.fk_struct_root_map_id = map.structure_id and page.structure_id = urating.ressubpath) +); + +create or replace view o_ep_notifications_comment_v as ( + select + ucomment.comment_id as comment_id, + map.structure_id as map_id, + map.title as map_title, + cast(ucomment.ressubpath as unsigned) as page_key, + page.title as page_title, + ucomment.creator_id as author_id, + ucomment.creationdate as creation_date + from o_usercomment as ucomment + inner join o_olatresource as comment_resource on (comment_resource.resid = ucomment.resid and comment_resource.resname = ucomment.resname) + inner join o_ep_struct_el as map on (map.fk_olatresource = comment_resource.resource_id) + left join o_ep_struct_el as page on (page.fk_struct_root_map_id = map.structure_id and page.structure_id = ucomment.ressubpath) +); + +create or replace view o_gp_business_to_repository_v as ( + select + grp.group_id as grp_id, + repoentry.repositoryentry_id as re_id, + repoentry.displayname as re_displayname + from o_gp_business as grp + inner join o_re_to_group as relation on (relation.fk_group_id = grp.fk_group_id) + inner join o_repositoryentry as repoentry on (repoentry.repositoryentry_id = relation.fk_entry_id) +); + +create or replace view o_bs_gp_membership_v as ( + select + membership.id as membership_id, + membership.fk_identity_id as fk_identity_id, + membership.lastmodified as lastmodified, + membership.creationdate as creationdate, + membership.g_role as g_role, + gp.group_id as group_id + from o_bs_group_member as membership + inner join o_gp_business as gp on (gp.fk_group_id=membership.fk_group_id) +); + +create or replace view o_gp_business_v as ( + select + gp.group_id as group_id, + gp.groupname as groupname, + gp.lastmodified as lastmodified, + gp.creationdate as creationdate, + gp.lastusage as lastusage, + gp.descr as descr, + gp.minparticipants as minparticipants, + gp.maxparticipants as maxparticipants, + gp.waitinglist_enabled as waitinglist_enabled, + gp.autocloseranks_enabled as autocloseranks_enabled, + gp.external_id as external_id, + gp.managed_flags as managed_flags, + (select count(part.id) from o_bs_group_member as part where part.fk_group_id = gp.fk_group_id and part.g_role='participant') as num_of_participants, + (select count(pending.reservation_id) from o_ac_reservation as pending where pending.fk_resource = gp.fk_resource) as num_of_pendings, + (select count(own.id) from o_bs_group_member as own where own.fk_group_id = gp.fk_group_id and own.g_role='coach') as num_of_owners, + (case when gp.waitinglist_enabled = true + then + (select count(waiting.id) from o_bs_group_member as waiting where waiting.fk_group_id = gp.fk_group_id and waiting.g_role='waiting') + else + 0 + end) as num_waiting, + (select count(offer.offer_id) from o_ac_offer as offer + where offer.fk_resource_id = gp.fk_resource + and offer.is_valid=true + and (offer.validfrom is null or offer.validfrom <= current_timestamp()) + and (offer.validto is null or offer.validto >= current_timestamp()) + ) as num_of_valid_offers, + (select count(offer.offer_id) from o_ac_offer as offer + where offer.fk_resource_id = gp.fk_resource + and offer.is_valid=true + ) as num_of_offers, + (select count(relation.fk_entry_id) from o_re_to_group as relation + where relation.fk_group_id = gp.fk_group_id + ) as num_of_relations, + gp.fk_resource as fk_resource, + gp.fk_group_id as fk_group_id + from o_gp_business as gp +); + +create or replace view o_re_membership_v as ( + select + bmember.id as membership_id, + bmember.creationdate as creationdate, + bmember.lastmodified as lastmodified, + bmember.fk_identity_id as fk_identity_id, + bmember.g_role as g_role, + re.repositoryentry_id as fk_entry_id + from o_repositoryentry as re + inner join o_re_to_group relgroup on (relgroup.fk_entry_id=re.repositoryentry_id and relgroup.r_defgroup=1) + inner join o_bs_group_member as bmember on (bmember.fk_group_id=relgroup.fk_group_id) +); + +-- contacts +create or replace view o_gp_contactkey_v as ( + select + bg_member.id as membership_id, + bg_member.fk_identity_id as member_id, + bg_member.g_role as membership_role, + bg_me.fk_identity_id as me_id, + bgroup.group_id as bg_id + from o_gp_business as bgroup + inner join o_bs_group_member as bg_member on (bg_member.fk_group_id = bgroup.fk_group_id) + inner join o_bs_group_member as bg_me on (bg_me.fk_group_id = bgroup.fk_group_id) + where + (bgroup.ownersintern=true and bg_member.g_role='coach') + or + (bgroup.participantsintern=true and bg_member.g_role='participant') +); + +create or replace view o_gp_contactext_v as ( + select + bg_member.id as membership_id, + bg_member.fk_identity_id as member_id, + bg_member.g_role as membership_role, + id_member.name as member_name, + first_member.propvalue as member_firstname, + last_member.propvalue as member_lastname, + bg_me.fk_identity_id as me_id, + bgroup.group_id as bg_id, + bgroup.groupname as bg_name + from o_gp_business as bgroup + inner join o_bs_group_member as bg_member on (bg_member.fk_group_id = bgroup.fk_group_id) + inner join o_bs_identity as id_member on (bg_member.fk_identity_id = id_member.id) + inner join o_user as us_member on (id_member.fk_user_id = us_member.user_id) + inner join o_userproperty as first_member on (first_member.fk_user_id = us_member.user_id and first_member.propname='firstName') + inner join o_userproperty as last_member on (last_member.fk_user_id = us_member.user_id and last_member.propname='lastName') + inner join o_bs_group_member as bg_me on (bg_me.fk_group_id = bgroup.fk_group_id) + where + (bgroup.ownersintern=true and bg_member.g_role='coach') + or + (bgroup.participantsintern=true and bg_member.g_role='participant') +); + +-- coaching +create or replace view o_as_eff_statement_identity_v as ( + select + sg_re.repositoryentry_id as re_id, + sg_participant.fk_identity_id as student_id, + sg_statement.id as st_id, + (case when sg_statement.passed = 1 then 1 else 0 end) as st_passed, + (case when sg_statement.passed = 0 then 1 else 0 end) as st_failed, + (case when sg_statement.passed is null then 1 else 0 end) as st_not_attempted, + sg_statement.score as st_score, + pg_initial_launch.id as pg_id + from o_repositoryentry as sg_re + inner join o_re_to_group as togroup on (togroup.fk_entry_id = sg_re.repositoryentry_id) + inner join o_bs_group_member as sg_participant on (sg_participant.fk_group_id=togroup.fk_group_id and sg_participant.g_role='participant') + left join o_as_eff_statement as sg_statement on (sg_statement.fk_identity = sg_participant.fk_identity_id and sg_statement.fk_resource_id = sg_re.fk_olatresource) + left join o_as_user_course_infos as pg_initial_launch on (pg_initial_launch.fk_resource_id = sg_re.fk_olatresource and pg_initial_launch.fk_identity = sg_participant.fk_identity_id) + group by sg_re.repositoryentry_id, sg_participant.fk_identity_id, + sg_statement.id, sg_statement.passed, sg_statement.score, pg_initial_launch.id +); + +create or replace view o_as_eff_statement_students_v as ( + select + sg_re.repositoryentry_id as re_id, + sg_coach.fk_identity_id as tutor_id, + sg_participant.fk_identity_id as student_id, + sg_statement.id as st_id, + (case when sg_statement.passed = 1 then 1 else 0 end) as st_passed, + (case when sg_statement.passed = 0 then 1 else 0 end) as st_failed, + (case when sg_statement.passed is null then 1 else 0 end) as st_not_attempted, + sg_statement.score as st_score, + pg_initial_launch.id as pg_id + from o_repositoryentry as sg_re + inner join o_re_to_group as togroup on (togroup.fk_entry_id = sg_re.repositoryentry_id) + inner join o_bs_group_member as sg_coach on (sg_coach.fk_group_id=togroup.fk_group_id and sg_coach.g_role in ('owner','coach')) + inner join o_bs_group_member as sg_participant on (sg_participant.fk_group_id=sg_coach.fk_group_id and sg_participant.g_role='participant') + left join o_as_eff_statement as sg_statement on (sg_statement.fk_identity = sg_participant.fk_identity_id and sg_statement.fk_resource_id = sg_re.fk_olatresource) + left join o_as_user_course_infos as pg_initial_launch on (pg_initial_launch.fk_resource_id = sg_re.fk_olatresource and pg_initial_launch.fk_identity = sg_participant.fk_identity_id) + group by sg_re.repositoryentry_id, sg_coach.fk_identity_id, sg_participant.fk_identity_id, + sg_statement.id, sg_statement.passed, sg_statement.score, pg_initial_launch.id +); + +create or replace view o_as_eff_statement_courses_v as ( + select + sg_re.repositoryentry_id as re_id, + sg_re.displayname as re_name, + sg_coach.fk_identity_id as tutor_id, + sg_participant.fk_identity_id as student_id, + sg_statement.id as st_id, + (case when sg_statement.passed = 1 then 1 else 0 end) as st_passed, + (case when sg_statement.passed = 0 then 1 else 0 end) as st_failed, + (case when sg_statement.passed is null then 1 else 0 end) as st_not_attempted, + sg_statement.score as st_score, + pg_initial_launch.id as pg_id + from o_repositoryentry as sg_re + inner join o_re_to_group as togroup on (togroup.fk_entry_id = sg_re.repositoryentry_id) + inner join o_bs_group_member as sg_coach on (sg_coach.fk_group_id=togroup.fk_group_id and sg_coach.g_role in ('owner','coach')) + inner join o_bs_group_member as sg_participant on (sg_participant.fk_group_id=sg_coach.fk_group_id and sg_participant.g_role='participant') + left join o_as_eff_statement as sg_statement on (sg_statement.fk_identity = sg_participant.fk_identity_id and sg_statement.fk_resource_id = sg_re.fk_olatresource) + left join o_as_user_course_infos as pg_initial_launch on (pg_initial_launch.fk_resource_id = sg_re.fk_olatresource and pg_initial_launch.fk_identity = sg_participant.fk_identity_id) + group by sg_re.repositoryentry_id, sg_re.displayname, sg_coach.fk_identity_id, sg_participant.fk_identity_id, + sg_statement.id, sg_statement.passed, sg_statement.score, pg_initial_launch.id +); + +create or replace view o_as_eff_statement_groups_v as ( + select + sg_re.repositoryentry_id as re_id, + sg_re.displayname as re_name, + sg_bg.group_id as bg_id, + sg_bg.groupname as bg_name, + sg_coach.fk_identity_id as tutor_id, + sg_participant.fk_identity_id as student_id, + sg_statement.id as st_id, + (case when sg_statement.passed = 1 then 1 else 0 end) as st_passed, + (case when sg_statement.passed = 0 then 1 else 0 end) as st_failed, + (case when sg_statement.passed is null then 1 else 0 end) as st_not_attempted, + sg_statement.score as st_score, + pg_initial_launch.id as pg_id + from o_repositoryentry as sg_re + inner join o_re_to_group as togroup on (togroup.fk_entry_id = sg_re.repositoryentry_id) + inner join o_gp_business as sg_bg on (sg_bg.fk_group_id=togroup.fk_group_id) + inner join o_bs_group_member as sg_coach on (sg_coach.fk_group_id=togroup.fk_group_id and sg_coach.g_role in ('owner','coach')) + inner join o_bs_group_member as sg_participant on (sg_participant.fk_group_id=sg_coach.fk_group_id and sg_participant.g_role='participant') + left join o_as_eff_statement as sg_statement on (sg_statement.fk_identity = sg_participant.fk_identity_id and sg_statement.fk_resource_id = sg_re.fk_olatresource) + left join o_as_user_course_infos as pg_initial_launch on (pg_initial_launch.fk_resource_id = sg_re.fk_olatresource and pg_initial_launch.fk_identity = sg_participant.fk_identity_id) + group by sg_re.repositoryentry_id, sg_re.displayname, sg_bg.group_id, sg_bg.groupname, + sg_coach.fk_identity_id, sg_participant.fk_identity_id, + sg_statement.id, sg_statement.passed, sg_statement.score, pg_initial_launch.id +); + +-- instant messaging +create or replace view o_im_roster_entry_v as ( + select + entry.id as re_id, + entry.creationdate as re_creationdate, + ident.id as ident_id, + ident.name as ident_name, + entry.r_nickname as re_nickname, + entry.r_fullname as re_fullname, + entry.r_anonym as re_anonym, + entry.r_vip as re_vip, + entry.r_resname as re_resname, + entry.r_resid as re_resid + from o_im_roster_entry as entry + inner join o_bs_identity as ident on (entry.fk_identity_id = ident.id) +); + +-- question pool +create or replace view o_qp_pool_2_item_short_v as ( + select + pool2item.id as item_to_pool_id, + pool2item.creationdate as item_to_pool_creationdate, + item.id as item_id, + pool2item.q_editable as item_editable, + pool2item.fk_pool_id as item_pool, + pool.q_name as item_pool_name + from o_qp_item as item + inner join o_qp_pool_2_item as pool2item on (pool2item.fk_item_id = item.id) + inner join o_qp_pool as pool on (pool2item.fk_pool_id = pool.id) +); + +create or replace view o_qp_share_2_item_short_v as ( + select + shareditem.id as item_to_share_id, + shareditem.creationdate as item_to_share_creationdate, + item.id as item_id, + shareditem.q_editable as item_editable, + shareditem.fk_resource_id as resource_id, + bgroup.groupname as resource_name + from o_qp_item as item + inner join o_qp_share_item as shareditem on (shareditem.fk_item_id = item.id) + inner join o_gp_business as bgroup on (shareditem.fk_resource_id = bgroup.fk_resource) +); + + diff --git a/src/main/resources/serviceconfig/olat.properties b/src/main/resources/serviceconfig/olat.properties index a68617bf19b4981b022efb6e8f79b6c98984830e..9c3b9f77e8fa23cb773f41f30361c29b9a420b8f 100644 --- a/src/main/resources/serviceconfig/olat.properties +++ b/src/main/resources/serviceconfig/olat.properties @@ -886,6 +886,27 @@ ldap.attrib.gen.map.ldapkey9= ldap.attrib.gen.map.olatkey9= ldap.attrib.gen.map.ldapkey10= ldap.attrib.gen.map.olatkey10= +ldap.attrib.gen.map.ldapkey11= +ldap.attrib.gen.map.olatkey11= +ldap.attrib.gen.map.ldapkey12= +ldap.attrib.gen.map.olatkey12= +ldap.attrib.gen.map.ldapkey13= +ldap.attrib.gen.map.olatkey13= +ldap.attrib.gen.map.ldapkey14= +ldap.attrib.gen.map.olatkey14= +ldap.attrib.gen.map.ldapkey15= +ldap.attrib.gen.map.olatkey15= +ldap.attrib.gen.map.ldapkey16= +ldap.attrib.gen.map.olatkey16= +ldap.attrib.gen.map.ldapkey17= +ldap.attrib.gen.map.olatkey17= +ldap.attrib.gen.map.ldapkey18= +ldap.attrib.gen.map.olatkey18= +ldap.attrib.gen.map.ldapkey19= +ldap.attrib.gen.map.olatkey19= +ldap.attrib.gen.map.ldapkey20= +ldap.attrib.gen.map.olatkey20= + #static mappings, olat-userproperties will be filled with given value ldap.attrib.static.olatkey1= ldap.attrib.static.value1=