1 /**
2 * Copyright 2004-2014 The Kuali Foundation
3 *
4 * Licensed under the Educational Community License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.opensource.org/licenses/ecl2.php
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package org.kuali.kpme.core.service.group;
17
18 import org.joda.time.DateTime;
19 import org.kuali.rice.kim.api.group.GroupMember;
20 import org.springframework.cache.annotation.Cacheable;
21
22 public interface KPMEGroupService {
23
24 /**
25 * Checks whether the given {@code principalId} is a member of the group {@code groupName}.
26 *
27 * @param principalId The person to check the group membership for
28 * @param groupName The name of the group
29 * @param asOfDate The effective date of the group membership
30 *
31 * @return true if {@code principalId} is a member of the group {@code groupName}, false otherwise.
32 */
33 @Cacheable(value= GroupMember.Cache.NAME, key="'{KPME|isMemberOfGroup}' + 'principal=' + #p0 + '|' + 'groupName=' + #p1 + '|' + 'asOfDate=' + #p2")
34 boolean isMemberOfGroup(String principalId, String groupName, DateTime asOfDate);
35
36 @Cacheable(value= GroupMember.Cache.NAME, key="'{KPME|isMemberOfGroupWithId}' + 'principal=' + #p0 + '|' + 'groupId=' + #p1 + '|' + 'asOfDate=' + #p2")
37 boolean isMemberOfGroupWithId(String principalId, String groupId, DateTime asOfDate);
38
39 /**
40 * Checks whether the given {@code principalId} is a system administrator.
41 *
42 * @param principalId The person to check the group membership for
43 * @param asOfDate The effective date of the group membership
44 *
45 * @return true if {@code principalId} is a system administrator, false otherwise
46 */
47 @Cacheable(value= GroupMember.Cache.NAME, key="'{KPME|isMemberOfSystemAdministratorGroup}' + 'principal=' + #p0 + '|' + 'asOfDate=' + #p1")
48 boolean isMemberOfSystemAdministratorGroup(String principalId, DateTime asOfDate);
49
50 /**
51 * Checks whether the given {@code principalId} is a system view only user.
52 *
53 * @param principalId The person to check the group membership for
54 * @param asOfDate The effective date of the group membership
55 *
56 * @return true if {@code principalId} is a system view only user, false otherwise
57 */
58 @Cacheable(value= GroupMember.Cache.NAME, key="'{KPME|isMemberOfSystemViewOnlyGroup}' + 'principal=' + #p0 + '|' + 'asOfDate=' + #p1")
59 boolean isMemberOfSystemViewOnlyGroup(String principalId, DateTime asOfDate);
60
61 }