libreccm-legacy/ccm-cms/pdl/com/arsdigita/content-section/CMSStaffAdmin.pdl

269 lines
6.4 KiB
Plaintext
Executable File

//
// Copyright (C) 2001-2004 Red Hat Inc. All Rights Reserved.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation; either version 2.1 of
// the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// $Id: CMSStaffAdmin.pdl 287 2005-02-22 00:29:02Z sskracic $
// $DateTime: 2004/08/17 23:15:09 $
model com.arsdigita.cms;
query getStaffRoles {
BigDecimal groupId;
BigDecimal sectionId;
String name;
do {
select
r.implicit_group_id, r.name, s.section_id
from
content_sections s, roles r
where
s.staff_group_id = r.group_id
} map {
groupId = r.implicit_group_id;
name = r.name;
sectionId = s.section_id;
}
}
query getUserStaffRoles {
BigDecimal groupId;
BigDecimal sectionId;
BigDecimal userId;
String name;
do {
select
r.implicit_group_id, r.name, s.section_id, gmm.member_id
from
content_sections s,
roles r, group_member_map gmm
where
s.staff_group_id = r.group_id
and
r.implicit_group_id = gmm.group_id
} map {
groupId = r.implicit_group_id;
name = r.name;
sectionId = s.section_id;
userId = gmm.member_id;
}
}
query getGroupStaffRoles {
BigDecimal groupId;
BigDecimal sectionId;
BigDecimal subgroupId;
String name;
do {
select
r.implicit_group_id, r.name, s.section_id, gsm.subgroup_id
from
content_sections s,
roles r, group_subgroup_map gsm
where
s.staff_group_id = r.group_id
and
r.implicit_group_id = gsm.group_id
} map {
groupId = r.implicit_group_id;
name = r.name;
sectionId = s.section_id;
subgroupId = gsm.subgroup_id;
}
}
query getViewerRoles {
BigDecimal groupId;
BigDecimal sectionId;
String name;
do {
select
r.implicit_group_id, r.name, s.section_id
from
content_sections s, roles r
where
s.viewers_group_id = r.group_id
} map {
groupId = r.implicit_group_id;
name = r.name;
sectionId = s.section_id;
}
}
query getUserViewerRoles {
BigDecimal groupId;
BigDecimal sectionId;
BigDecimal userId;
String name;
do {
select
r.implicit_group_id, r.name, s.section_id, gmm.member_id
from
content_sections s,
roles r, group_member_map gmm
where
s.viewers_group_id = r.group_id
and
r.implicit_group_id = gmm.group_id
} map {
groupId = r.implicit_group_id;
name = r.name;
sectionId = s.section_id;
userId = gmm.member_id;
}
}
query getGroupViewerRoles {
BigDecimal groupId;
BigDecimal sectionId;
BigDecimal subgroupId;
String name;
do {
select
r.implicit_group_id, r.name, s.section_id, gsm.subgroup_id
from
content_sections s,
roles r, group_subgroup_map gsm
where
s.viewers_group_id = r.group_id
and
r.implicit_group_id = gsm.group_id
} map {
groupId = r.implicit_group_id;
name = r.name;
sectionId = s.section_id;
subgroupId = gsm.subgroup_id;
}
}
// common filters applied to this query:
// match query - "upper(lastName) like '%'|| :lastName ||'%'"
//
query searchToAddMembers {
BigDecimal userId;
String name;
String screenName;
String email;
String lastName;
String firstName;
do {
select
u.user_id, (n.family_name || ', ' || n.given_name) as person_name,
u.screen_name, p.primary_email, n.given_name, n.family_name
from
users u , person_names n , parties p
where
p.party_id = u.user_id
and
u.name_id = n.name_id
and
not exists (
select 1 from
group_member_map g, roles r
where
g.member_id = user_id
and
r.implicit_group_id = g.group_id
and
r.role_id = :excludedRoleId )
} map {
userId = u.user_id;
name = person_name;
screenName = u.screen_name;
email = p.primary_email;
lastName = n.family_name;
firstName = n.given_name;
}
}
query searchToAddMemberParties {
BigDecimal partyId;
String name;
String email;
Boolean isUser;
do {
select
p.party_id, (n.family_name || ', ' || n.given_name) as party_name,
p.primary_email, 1 as is_user
from
users u , person_names n , parties p
where
p.party_id = u.user_id
and
u.name_id = n.name_id
and
not exists (
select 1 from
group_member_map g, roles r
where
g.member_id = party_id
and
r.implicit_group_id = g.group_id
and
r.role_id = :excludedRoleId )
union all
select
p.party_id, g.name as party_name,
p.primary_email, 0 as is_user
from
groups g, parties p
where
p.party_id = g.group_id
and
not exists (
select 1 from
group_subgroup_map g, roles r
where
g.subgroup_id = party_id
and
r.implicit_group_id = g.group_id
and
r.role_id = :excludedRoleId )
and
not exists (
select 1 from
group_subgroup_trans_map g, roles r
where
g.group_id = party_id
and
r.implicit_group_id = g.subgroup_id
and
r.role_id = :excludedRoleId )
} map {
partyId = p.party_id;
name = party_name;
email = p.primary_email;
isUser = is_user;
}
}
// filter: where memberId = :memberId and groupId = :groupId
query isRoleMember {
BigDecimal memberId;
BigDecimal groupId;
do {
select
member_id, group_id
from
group_member_map
} map {
memberId = group_member_map.member_id;
groupId = group_mamber_map.group_id;
}
}