2 * DemosceneMusic - User.java - Copyright © 2012 David Roden
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 package net.pterodactylus.demoscenemusic.data;
20 import java.util.Collection;
23 * Data container for users of the website.
25 * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
27 public interface User extends Base {
29 /** Privilege level for site gods. */
30 public static final int LEVEL_GOD = 100;
32 /** Privilege level for normal users. */
33 public static final int LEVEL_USER = 0;
36 * Returns the name of this user.
38 * @return The name of this user
40 public String getName();
43 * Sets the name of this user.
46 * The name of this user
49 public User setName(String name);
52 * Sets the password of this user.
55 * The new password of this user
58 public User setPassword(String password);
61 * Sets the hash of the password of this user.
64 * The hash of the user’s password
67 public User setPasswordHash(String passwordHash);
70 * Verifies the given password.
73 * The password to verify
74 * @return {@code true} if the given password matches the user’s password,
75 * {@code false} otherwise
77 public boolean verifyPassword(String password);
80 * Returns the privilege level of this user. 0 is the level of a normal user
81 * without any special privileges.
83 * @return The privilege level of this user
85 public int getLevel();
88 * Sets the privilege level of this user.
91 * The privilege level of this user
94 public User setLevel(int level);
97 * Returns all OpenIDs connected with this user.
99 * @return All OpenIDs connected with this user
101 public Collection<String> getOpenIds();
104 * Sets all OpenIDs connected with this user.
107 * All OpenIDs connected with this user
110 public User setOpenIds(Collection<String> openIds);