From efcd05460aea3a517d03d1b36fd6ff81ac7cf12e Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Thu, 26 Apr 2012 15:33:23 +0200 Subject: [PATCH] Add privilege level to user. --- .../pterodactylus/demoscenemusic/data/DataManager.java | 2 +- .../pterodactylus/demoscenemusic/data/DefaultUser.java | 2 ++ .../net/pterodactylus/demoscenemusic/data/User.java | 17 +++++++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/pterodactylus/demoscenemusic/data/DataManager.java b/src/main/java/net/pterodactylus/demoscenemusic/data/DataManager.java index e6bc6da..48c5ace 100644 --- a/src/main/java/net/pterodactylus/demoscenemusic/data/DataManager.java +++ b/src/main/java/net/pterodactylus/demoscenemusic/data/DataManager.java @@ -654,7 +654,7 @@ public class DataManager { */ @Override public User createObject(ResultSet resultSet) throws SQLException { - return new LazyUser(resultSet.getString("USERS.ID")).setName(resultSet.getString("USERS.NAME")); + return new LazyUser(resultSet.getString("USERS.ID")).setName(resultSet.getString("USERS.NAME")).setLevel(resultSet.getInt("USERS.LEVEL")); } } diff --git a/src/main/java/net/pterodactylus/demoscenemusic/data/DefaultUser.java b/src/main/java/net/pterodactylus/demoscenemusic/data/DefaultUser.java index 74a65a1..ea2959c 100644 --- a/src/main/java/net/pterodactylus/demoscenemusic/data/DefaultUser.java +++ b/src/main/java/net/pterodactylus/demoscenemusic/data/DefaultUser.java @@ -19,6 +19,8 @@ package net.pterodactylus.demoscenemusic.data; import java.util.Collection; +import net.pterodactylus.util.object.Default; + /** * Default implementation of a user data container. * diff --git a/src/main/java/net/pterodactylus/demoscenemusic/data/User.java b/src/main/java/net/pterodactylus/demoscenemusic/data/User.java index cfb32a7..50468ca 100644 --- a/src/main/java/net/pterodactylus/demoscenemusic/data/User.java +++ b/src/main/java/net/pterodactylus/demoscenemusic/data/User.java @@ -43,6 +43,23 @@ public interface User extends Base { public User setName(String name); /** + * Returns the privilege level of this user. 0 is the level of a normal user + * without any special privileges. + * + * @return The privilege level of this user + */ + public int getLevel(); + + /** + * Sets the privilege level of this user. + * + * @param level + * The privilege level of this user + * @return This user + */ + public User setLevel(int level); + + /** * Returns all OpenIDs connected with this user. * * @return All OpenIDs connected with this user -- 2.7.4