1 /*
2 * Licensed to The Apereo Foundation under one or more contributor license
3 * agreements. See the NOTICE file distributed with this work for additional
4 * information regarding copyright ownership.
5 *
6 *
7 * The Apereo Foundation licenses this file to you under the Educational
8 * Community License, Version 2.0 (the "License"); you may not use this file
9 * except in compliance with the License. You may obtain a copy of the License
10 * at:
11 *
12 * http://opensource.org/licenses/ecl2.txt
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
16 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
17 * License for the specific language governing permissions and limitations under
18 * the License.
19 *
20 */
21
22 package org.opencastproject.security.api;
23
24 import java.util.Set;
25
26 /**
27 * Represent a user in Opencast
28 */
29 public interface User {
30
31 /**
32 * Gets this user's unique account name.
33 *
34 * @return the account name
35 */
36 String getUsername();
37
38 /**
39 * Gets this user's password, if available.
40 *
41 * @return the password
42 */
43 String getPassword();
44
45 /**
46 * Gets the user's name.
47 *
48 * @return the user name
49 */
50 String getName();
51
52 /**
53 * Gets the user's email address.
54 *
55 * @return the user's email address
56 */
57 String getEmail();
58
59 /**
60 * Gets the provider where the user is coming from.
61 *
62 * @return the provider where the user is coming from.
63 */
64 String getProvider();
65
66 /**
67 * Returns <code>true</code> if this user object can be managed by Opencast.
68 *
69 * @return <code>true</code> if this user is manageable
70 */
71 boolean isManageable();
72
73 /**
74 * Returns the user's organization identifier.
75 *
76 * @return the organization
77 */
78 Organization getOrganization();
79
80 /**
81 * Gets the user's roles. For anonymous users, this will return Anonymous.
82 *
83 * @return the user's roles
84 */
85 Set<Role> getRoles();
86
87 /**
88 * Returns whether the user is in a specific role.
89 *
90 * @param role
91 * the role to check
92 * @return whether the role is one of this user's roles
93 */
94 boolean hasRole(String role);
95
96 }