From: David ‘Bombe’ Roden Date: Thu, 26 Apr 2012 13:33:23 +0000 (+0200) Subject: Add privilege level to user. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=efcd05460aea3a517d03d1b36fd6ff81ac7cf12e;p=demoscenemusic.git Add privilege level to user. --- 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