1 package org.apache.fulcrum.security.model.dynamic.entity.impl;
2
3 /*
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
19 * under the License.
20 */
21
22 import java.util.HashSet;
23 import java.util.Set;
24
25 import org.apache.fulcrum.security.entity.User;
26 import org.apache.fulcrum.security.model.basic.entity.impl.BasicUserImpl;
27 import org.apache.fulcrum.security.model.dynamic.entity.DynamicUser;
28
29 /**
30 * Represents the "simple" model where permissions are related to roles, roles
31 * are related to groups and groups are related to users, all in many to many
32 * relationships.
33 *
34 * Users have a set of delegates and delegatee's. If user A has B in their
35 * delegates - B assumes A's groups,roles and permissions If user C has D in
36 * their delegatees - C assumes D's groups,roles and permissions
37 *
38 * @author <a href="mailto:epugh@upstate.com">Eric Pugh</a>
39 * @version $Id: DynamicUser.java 437451 2006-08-27 20:20:44Z tv $
40 */
41 public class DynamicUserImpl extends BasicUserImpl implements DynamicUser
42 {
43 /**
44 * Serial number
45 */
46 private static final long serialVersionUID = 2841311062371647853L;
47
48 private Set<? extends User> delegators = new HashSet<User>();
49
50 private Set<? extends User> delegatees = new HashSet<User>();
51
52 /**
53 * Get the set of delegatees for this user
54 *
55 * @return Returns the delegatees.
56 */
57 @SuppressWarnings("unchecked")
58 public <T extends User> Set<T> getDelegatees()
59 {
60 return (Set<T>) delegatees;
61 }
62
63 /**
64 * Set the delegatees for this user
65 *
66 * @param delegatees
67 * The delegatees to set.
68 */
69 public <T extends User> void setDelegatees(Set<T> delegatees)
70 {
71 this.delegatees = delegatees;
72 }
73
74 /**
75 * Get the set of delegators for this user
76 *
77 * @return Returns the delegators.
78 */
79 @SuppressWarnings("unchecked")
80 public <T extends User> Set<T> getDelegators()
81 {
82 return (Set<T>) delegators;
83 }
84
85 /**
86 * Set the delegators for this user
87 *
88 * @param delegators
89 * The delegators to set.
90 */
91 public <T extends User> void setDelegators(Set<T> delegators)
92 {
93 this.delegators = delegators;
94 }
95 }