mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-26 16:30:52 +01:00
User permissions
This commit is contained in:
parent
a0c1973622
commit
78dc916edc
173
sqlupdates/2_3_0 TO 2_4_0-RC1.sql
Normal file
173
sqlupdates/2_3_0 TO 2_4_0-RC1.sql
Normal file
@ -0,0 +1,173 @@
|
|||||||
|
SET FOREIGN_KEY_CHECKS=0;
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Table structure for `user_permissions`
|
||||||
|
-- ----------------------------
|
||||||
|
DROP TABLE IF EXISTS `user_permissions`;
|
||||||
|
CREATE TABLE `user_permissions` (
|
||||||
|
`user_id` int(11) NOT NULL,
|
||||||
|
`cmd_about` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_alert` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_allow_trading` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_badge` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_ban` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_blockalert` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_bots` enum('-1','0','1','2') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_bundle` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_calendar` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_changename` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_chatcolor` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_commands` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_connect_camera` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_control` enum('-1','0','1','2') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_coords` enum('-1','0','1','2') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_credits` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_danceall` enum('-1','0','1','2') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_diagonal` enum('-1','0','1','2') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_disconnect` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_duckets` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_ejectall` enum('-1','0','1','2') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_empty` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_empty_bots` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_empty_pets` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_enable` enum('-1','0','1','2') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_event` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_faceless` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_fastwalk` enum('-1','0','1','2') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_filterword` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_freeze` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_freeze_bots` enum('-1','0','1','2') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_gift` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_give_rank` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_ha` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`acc_can_stalk` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_hal` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_invisible` enum('-1','0','1','2') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_ip_ban` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_machine_ban` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_hand_item` enum('-1','0','1','2') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_happyhour` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_hidewired` enum('-1','0','1','2') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_kickall` enum('-1','0','1','2') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_massbadge` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_masscredits` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_massduckets` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_massgift` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_masspoints` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_moonwalk` enum('-1','0','1','2') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_mimic` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_multi` enum('-1','0','1','2') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_mute` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_pet_info` enum('-1','0','1','2') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_pickall` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_plugins` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_points` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_promote_offer` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_pull` enum('-1','0','1','2') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_push` enum('-1','0','1','2') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_redeem` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_reload_room` enum('-1','0','1','2') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_roomalert` enum('-1','0','1','2') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_roomcredits` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_roomeffect` enum('-1','0','1','2') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_roomgift` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_roomitem` enum('-1','0','1','2') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_roommute` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_roompixels` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_roompoints` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_say` enum('-1','0','1','2') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_say_all` enum('-1','0','1','2') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_setmax` enum('-1','0','1','2') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_set_poll` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_setpublic` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_setspeed` enum('-1','0','1','2') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_shout` enum('-1','0','1','2') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_shout_all` enum('-1','0','1','2') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_shutdown` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_sitdown` enum('-1','0','1','2') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_staffalert` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_staffonline` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_summon` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_summonrank` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_super_ban` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_stalk` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_superpull` enum('-1','0','1','2') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_take_badge` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_talk` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_teleport` enum('-1','0','1','2') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_trash` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_transform` enum('-1','0','1','2') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_unban` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_unload` enum('-1','0','1','2') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_unmute` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_update_achievements` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_update_bots` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_update_catalogue` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_update_config` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_update_guildparts` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_update_hotel_view` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_update_items` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_update_navigator` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_update_permissions` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_update_pet_data` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_update_plugins` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_update_polls` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_update_texts` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_update_wordfilter` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_userinfo` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_word_quiz` enum('-1','0','1','2') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_warp` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`acc_anychatcolor` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`acc_anyroomowner` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`acc_empty_others` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`acc_enable_others` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`acc_see_whispers` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`acc_superwired` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`acc_supporttool` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`acc_unkickable` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`acc_guildgate` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`acc_moverotate` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`acc_placefurni` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`acc_unlimited_bots` enum('-1','0','1','2') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1' COMMENT 'Overrides the bot restriction to the inventory and room.',
|
||||||
|
`acc_unlimited_pets` enum('-1','0','1','2') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1' COMMENT 'Overrides the pet restriction to the inventory and room.',
|
||||||
|
`acc_hide_ip` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`acc_not_mimiced` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`acc_chat_no_flood` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`acc_staff_chat` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`acc_staff_pick` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`acc_enteranyroom` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`acc_fullrooms` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`acc_infinite_credits` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`acc_infinite_pixels` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`acc_infinite_points` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`acc_ambassador` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`acc_debug` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`acc_chat_no_limit` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1' COMMENT 'People with this permission node are always heard and can see all chat in the room regarding of maximum hearing distance in the room settings (In game)',
|
||||||
|
`acc_chat_no_filter` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`acc_nomute` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`acc_guild_admin` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`acc_catalog_ids` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`acc_modtool_ticket_q` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`acc_modtool_user_logs` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`acc_modtool_user_alert` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`acc_modtool_user_kick` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`acc_modtool_user_ban` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`acc_modtool_room_info` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`acc_modtool_room_logs` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`acc_trade_anywhere` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`acc_update_notifications` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`acc_helper_use_guide_tool` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`acc_helper_give_guide_tours` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`acc_helper_judge_chat_reviews` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`acc_floorplan_editor` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`acc_camera` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`acc_ads_background` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_wordquiz` enum('-1','0','1','2') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`acc_room_staff_tags` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`acc_infinite_friends` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`acc_mimic_unredeemed` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_update_youtube_playlists` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`cmd_add_youtube_playlist` enum('-1','0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
`acc_mention` enum('-1','0','1','2') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '-1',
|
||||||
|
PRIMARY KEY (`user_id`) USING BTREE
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;
|
@ -16,6 +16,7 @@ import com.eu.habbo.habbohotel.modtool.ModToolSanctions;
|
|||||||
import com.eu.habbo.habbohotel.modtool.WordFilter;
|
import com.eu.habbo.habbohotel.modtool.WordFilter;
|
||||||
import com.eu.habbo.habbohotel.navigation.NavigatorManager;
|
import com.eu.habbo.habbohotel.navigation.NavigatorManager;
|
||||||
import com.eu.habbo.habbohotel.permissions.PermissionsManager;
|
import com.eu.habbo.habbohotel.permissions.PermissionsManager;
|
||||||
|
import com.eu.habbo.habbohotel.permissions.UserPermissionsManager;
|
||||||
import com.eu.habbo.habbohotel.pets.PetManager;
|
import com.eu.habbo.habbohotel.pets.PetManager;
|
||||||
import com.eu.habbo.habbohotel.polls.PollManager;
|
import com.eu.habbo.habbohotel.polls.PollManager;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomManager;
|
import com.eu.habbo.habbohotel.rooms.RoomManager;
|
||||||
@ -49,6 +50,7 @@ public class GameEnvironment {
|
|||||||
private WordFilter wordFilter;
|
private WordFilter wordFilter;
|
||||||
private CraftingManager craftingManager;
|
private CraftingManager craftingManager;
|
||||||
private PollManager pollManager;
|
private PollManager pollManager;
|
||||||
|
private UserPermissionsManager userPermissionsManager;
|
||||||
|
|
||||||
public void load() throws Exception {
|
public void load() throws Exception {
|
||||||
LOGGER.info("GameEnvironment -> Loading...");
|
LOGGER.info("GameEnvironment -> Loading...");
|
||||||
@ -73,6 +75,7 @@ public class GameEnvironment {
|
|||||||
this.wordFilter = new WordFilter();
|
this.wordFilter = new WordFilter();
|
||||||
this.craftingManager = new CraftingManager();
|
this.craftingManager = new CraftingManager();
|
||||||
this.pollManager = new PollManager();
|
this.pollManager = new PollManager();
|
||||||
|
this.userPermissionsManager = new UserPermissionsManager();
|
||||||
|
|
||||||
this.roomManager.loadPublicRooms();
|
this.roomManager.loadPublicRooms();
|
||||||
this.navigatorManager.loadNavigator();
|
this.navigatorManager.loadNavigator();
|
||||||
@ -142,6 +145,10 @@ public class GameEnvironment {
|
|||||||
return this.permissionsManager;
|
return this.permissionsManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public UserPermissionsManager getUserPermissionsManager() {
|
||||||
|
return this.userPermissionsManager;
|
||||||
|
}
|
||||||
|
|
||||||
public BotManager getBotManager() {
|
public BotManager getBotManager() {
|
||||||
return this.botManager;
|
return this.botManager;
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,8 @@ import com.eu.habbo.core.CommandLog;
|
|||||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||||
import com.eu.habbo.habbohotel.permissions.Permission;
|
import com.eu.habbo.habbohotel.permissions.Permission;
|
||||||
import com.eu.habbo.habbohotel.permissions.PermissionSetting;
|
import com.eu.habbo.habbohotel.permissions.PermissionSetting;
|
||||||
|
import com.eu.habbo.habbohotel.permissions.UserPermission;
|
||||||
|
import com.eu.habbo.habbohotel.permissions.UserPermissionSetting;
|
||||||
import com.eu.habbo.habbohotel.pets.Pet;
|
import com.eu.habbo.habbohotel.pets.Pet;
|
||||||
import com.eu.habbo.habbohotel.pets.PetCommand;
|
import com.eu.habbo.habbohotel.pets.PetCommand;
|
||||||
import com.eu.habbo.habbohotel.pets.PetVocalsType;
|
import com.eu.habbo.habbohotel.pets.PetVocalsType;
|
||||||
@ -309,6 +311,66 @@ public class CommandHandler {
|
|||||||
return allowedCommands;
|
return allowedCommands;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<Command> getCommandsForUser(int userId) {
|
||||||
|
List<Command> allowedCommands = new ArrayList<>();
|
||||||
|
if (Emulator.getGameEnvironment().getUserPermissionsManager().userExists(userId)) {
|
||||||
|
THashMap<String, UserPermission> permissions = Emulator.getGameEnvironment().getUserPermissionsManager().getUserRank(userId).getPermissions();
|
||||||
|
|
||||||
|
for (Command command : commands.values()) {
|
||||||
|
if (allowedCommands.contains(command))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (permissions.contains(command.permission) && permissions.get(command.permission).setting != UserPermissionSetting.DISALLOWED && permissions.get(command.permission).setting != UserPermissionSetting.IGNORED) {
|
||||||
|
allowedCommands.add(command);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
allowedCommands.sort(CommandHandler.ALPHABETICAL_ORDER);
|
||||||
|
|
||||||
|
return allowedCommands;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Command> getIgnoredCommandsForUser(int userId) {
|
||||||
|
List<Command> allowedCommands = new ArrayList<>();
|
||||||
|
if (Emulator.getGameEnvironment().getUserPermissionsManager().userExists(userId)) {
|
||||||
|
THashMap<String, UserPermission> permissions = Emulator.getGameEnvironment().getUserPermissionsManager().getUserRank(userId).getPermissions();
|
||||||
|
|
||||||
|
for (Command command : commands.values()) {
|
||||||
|
if (allowedCommands.contains(command))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (permissions.contains(command.permission) && permissions.get(command.permission).setting == UserPermissionSetting.IGNORED) {
|
||||||
|
allowedCommands.add(command);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
allowedCommands.sort(CommandHandler.ALPHABETICAL_ORDER);
|
||||||
|
|
||||||
|
return allowedCommands;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Command> getDisallowedCommandsForUser(int userId) {
|
||||||
|
List<Command> allowedCommands = new ArrayList<>();
|
||||||
|
if (Emulator.getGameEnvironment().getUserPermissionsManager().userExists(userId)) {
|
||||||
|
THashMap<String, UserPermission> permissions = Emulator.getGameEnvironment().getUserPermissionsManager().getUserRank(userId).getPermissions();
|
||||||
|
|
||||||
|
for (Command command : commands.values()) {
|
||||||
|
if (allowedCommands.contains(command))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (permissions.contains(command.permission) && permissions.get(command.permission).setting == UserPermissionSetting.DISALLOWED) {
|
||||||
|
allowedCommands.add(command);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
allowedCommands.sort(CommandHandler.ALPHABETICAL_ORDER);
|
||||||
|
|
||||||
|
return allowedCommands;
|
||||||
|
}
|
||||||
|
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
commands.clear();
|
commands.clear();
|
||||||
LOGGER.info("Command Handler -> Disposed!");
|
LOGGER.info("Command Handler -> Disposed!");
|
||||||
|
@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.commands;
|
|||||||
import com.eu.habbo.Emulator;
|
import com.eu.habbo.Emulator;
|
||||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class CommandsCommand extends Command {
|
public class CommandsCommand extends Command {
|
||||||
@ -14,9 +15,20 @@ public class CommandsCommand extends Command {
|
|||||||
public boolean handle(GameClient gameClient, String[] params) throws Exception {
|
public boolean handle(GameClient gameClient, String[] params) throws Exception {
|
||||||
StringBuilder message = new StringBuilder(Emulator.getTexts().getValue("commands.generic.cmd_commands.text"));
|
StringBuilder message = new StringBuilder(Emulator.getTexts().getValue("commands.generic.cmd_commands.text"));
|
||||||
List<Command> commands = Emulator.getGameEnvironment().getCommandHandler().getCommandsForRank(gameClient.getHabbo().getHabboInfo().getRank().getId());
|
List<Command> commands = Emulator.getGameEnvironment().getCommandHandler().getCommandsForRank(gameClient.getHabbo().getHabboInfo().getRank().getId());
|
||||||
message.append("(").append(commands.size()).append("):\r\n");
|
List<Command> userCommands = Emulator.getGameEnvironment().getCommandHandler().getCommandsForUser(gameClient.getHabbo().getHabboInfo().getId());
|
||||||
|
List<Command> disallowedUserCommands = Emulator.getGameEnvironment().getCommandHandler().getDisallowedCommandsForUser(gameClient.getHabbo().getHabboInfo().getId());
|
||||||
|
|
||||||
for (Command c : commands) {
|
List<Command> allCommands = new ArrayList<>();
|
||||||
|
|
||||||
|
for(Command iterateCommand : commands) {
|
||||||
|
if(userCommands.contains(iterateCommand) || (!userCommands.contains(iterateCommand) && !disallowedUserCommands.contains(iterateCommand))) {
|
||||||
|
allCommands.add(iterateCommand);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
message.append("(").append(allCommands.size()).append("):\r\n");
|
||||||
|
|
||||||
|
for (Command c : allCommands) {
|
||||||
message.append(Emulator.getTexts().getValue("commands.description." + c.permission, "commands.description." + c.permission)).append("\r");
|
message.append(Emulator.getTexts().getValue("commands.description." + c.permission, "commands.description." + c.permission)).append("\r");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@ public class UpdatePermissionsCommand extends Command {
|
|||||||
@Override
|
@Override
|
||||||
public boolean handle(GameClient gameClient, String[] params) throws Exception {
|
public boolean handle(GameClient gameClient, String[] params) throws Exception {
|
||||||
Emulator.getGameEnvironment().getPermissionsManager().reload();
|
Emulator.getGameEnvironment().getPermissionsManager().reload();
|
||||||
|
Emulator.getGameEnvironment().getUserPermissionsManager().reload();
|
||||||
|
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_update_permissions"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_update_permissions"), RoomChatMessageBubbles.ALERT);
|
||||||
|
|
||||||
|
@ -113,12 +113,20 @@ public class PermissionsManager {
|
|||||||
|
|
||||||
public boolean hasPermission(Habbo habbo, String permission, boolean withRoomRights) {
|
public boolean hasPermission(Habbo habbo, String permission, boolean withRoomRights) {
|
||||||
if (!this.hasPermission(habbo.getHabboInfo().getRank(), permission, withRoomRights)) {
|
if (!this.hasPermission(habbo.getHabboInfo().getRank(), permission, withRoomRights)) {
|
||||||
for (HabboPlugin plugin : Emulator.getPluginManager().getPlugins()) {
|
if(this.permissionIgnored(habbo, permission) || (!this.hasUserPermission(habbo, permission, withRoomRights) && !this.permissionIgnored(habbo, permission))){
|
||||||
if (plugin.hasPermission(habbo, permission)) {
|
for (HabboPlugin plugin : Emulator.getPluginManager().getPlugins()) {
|
||||||
return true;
|
if (plugin.hasPermission(habbo, permission)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!this.hasUserPermission(habbo, permission, withRoomRights) && !this.permissionIgnored(habbo, permission)){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,6 +138,14 @@ public class PermissionsManager {
|
|||||||
return rank.hasPermission(permission, withRoomRights);
|
return rank.hasPermission(permission, withRoomRights);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean hasUserPermission(Habbo habbo, String permission, boolean withRoomRights) {
|
||||||
|
return habbo.hasUserPermission(permission, withRoomRights);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean permissionIgnored(Habbo habbo, String permission) {
|
||||||
|
return habbo.permissionIgnored(permission);
|
||||||
|
}
|
||||||
|
|
||||||
public Set<String> getStaffBadges() {
|
public Set<String> getStaffBadges() {
|
||||||
return this.badges.keySet();
|
return this.badges.keySet();
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,54 @@
|
|||||||
|
package com.eu.habbo.habbohotel.permissions;
|
||||||
|
|
||||||
|
public class UserPermission {
|
||||||
|
public static String ACC_ANYCHATCOLOR = "acc_anychatcolor";
|
||||||
|
public static String ACC_ANYROOMOWNER = "acc_anyroomowner";
|
||||||
|
public static String ACC_EMPTY_OTHERS = "acc_empty_others";
|
||||||
|
public static String ACC_ENABLE_OTHERS = "acc_enable_others";
|
||||||
|
public static String ACC_SEE_WHISPERS = "acc_see_whispers";
|
||||||
|
public static String ACC_SUPERWIRED = "acc_superwired";
|
||||||
|
public static String ACC_SUPPORTTOOL = "acc_supporttool";
|
||||||
|
public static String ACC_UNKICKABLE = "acc_unkickable";
|
||||||
|
public static String ACC_GUILDGATE = "acc_guildgate";
|
||||||
|
public static String ACC_MOVEROTATE = "acc_moverotate";
|
||||||
|
public static String ACC_PLACEFURNI = "acc_placefurni";
|
||||||
|
public static String ACC_UNLIMITED_BOTS = "acc_unlimited_bots";
|
||||||
|
public static String ACC_UNLIMITED_PETS = "acc_unlimited_pets";
|
||||||
|
public static String ACC_HIDE_IP = "acc_hide_ip";
|
||||||
|
public static String ACC_NOT_MIMICED = "acc_not_mimiced";
|
||||||
|
public static String ACC_CHAT_NO_FLOOD = "acc_chat_no_flood";
|
||||||
|
public static String ACC_STAFF_CHAT = "acc_staff_chat";
|
||||||
|
public static String ACC_STAFF_PICK = "acc_staff_pick";
|
||||||
|
public static String ACC_ENTERANYROOM = "acc_enteranyroom";
|
||||||
|
public static String ACC_FULLROOMS = "acc_fullrooms";
|
||||||
|
public static String ACC_INFINITE_CREDITS = "acc_infinite_credits";
|
||||||
|
public static String ACC_INFINITE_PIXELS = "acc_infinite_pixels";
|
||||||
|
public static String ACC_INFINITE_POINTS = "acc_infinite_points";
|
||||||
|
public static String ACC_AMBASSADOR = "acc_ambassador";
|
||||||
|
public static String ACC_DEBUG = "acc_debug";
|
||||||
|
public static String ACC_CHAT_NO_LIMIT = "acc_chat_no_limit";
|
||||||
|
public static String ACC_CHAT_NO_FILTER = "acc_chat_no_filter";
|
||||||
|
public static String ACC_NOMUTE = "acc_nomute";
|
||||||
|
public static String ACC_GUILD_ADMIN = "acc_guild_admin";
|
||||||
|
public static String ACC_CATALOG_IDS = "acc_catalog_ids";
|
||||||
|
public static String ACC_MODTOOL_TICKET_Q = "acc_modtool_ticket_q";
|
||||||
|
public static String ACC_MODTOOL_USER_LOGS = "acc_modtool_user_logs";
|
||||||
|
public static String ACC_MODTOOL_USER_ALERT = "acc_modtool_user_alert";
|
||||||
|
public static String ACC_MODTOOL_USER_KICK = "acc_modtool_user_kick";
|
||||||
|
public static String ACC_MODTOOL_USER_BAN = "acc_modtool_user_ban";
|
||||||
|
public static String ACC_MODTOOL_ROOM_INFO = "acc_modtool_room_info";
|
||||||
|
public static String ACC_MODTOOL_ROOM_LOGS = "acc_modtool_room_logs";
|
||||||
|
public static String ACC_TRADE_ANYWHERE = "acc_trade_anywhere";
|
||||||
|
public static String ACC_UPDATE_NOTIFICATIONS = "acc_update_notifications";
|
||||||
|
public static String ACC_HELPER_USE_GUIDE_TOOL = "acc_helper_use_guide_tool";
|
||||||
|
public static String ACC_HELPER_GIVE_GUIDE_TOURS = "acc_helper_give_guide_tours";
|
||||||
|
public static String ACC_HELPER_JUDGE_CHAT_REVIEWS = "acc_helper_judge_chat_reviews";
|
||||||
|
public static String ACC_FLOORPLAN_EDITOR = "acc_floorplan_editor";
|
||||||
|
public static String ACC_CAMERA = "acc_camera";
|
||||||
|
public final String key;
|
||||||
|
public final UserPermissionSetting setting;
|
||||||
|
public UserPermission(String key, UserPermissionSetting setting) {
|
||||||
|
this.key = key;
|
||||||
|
this.setting = setting;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,29 @@
|
|||||||
|
package com.eu.habbo.habbohotel.permissions;
|
||||||
|
|
||||||
|
public enum UserPermissionSetting {
|
||||||
|
|
||||||
|
IGNORED,
|
||||||
|
|
||||||
|
|
||||||
|
DISALLOWED,
|
||||||
|
|
||||||
|
|
||||||
|
ALLOWED,
|
||||||
|
|
||||||
|
|
||||||
|
ROOM_OWNER;
|
||||||
|
|
||||||
|
public static UserPermissionSetting fromString(String value) {
|
||||||
|
switch (value) {
|
||||||
|
case "-1":
|
||||||
|
return IGNORED;
|
||||||
|
case "1":
|
||||||
|
return ALLOWED;
|
||||||
|
case "2":
|
||||||
|
return ROOM_OWNER;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return DISALLOWED;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,97 @@
|
|||||||
|
package com.eu.habbo.habbohotel.permissions;
|
||||||
|
|
||||||
|
import com.eu.habbo.Emulator;
|
||||||
|
import com.eu.habbo.habbohotel.users.Habbo;
|
||||||
|
import gnu.trove.map.hash.TIntObjectHashMap;
|
||||||
|
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
|
||||||
|
public class UserPermissionsManager {
|
||||||
|
|
||||||
|
private final TIntObjectHashMap<UserRank> userRanks;
|
||||||
|
|
||||||
|
public UserPermissionsManager() {
|
||||||
|
long millis = System.currentTimeMillis();
|
||||||
|
this.userRanks = new TIntObjectHashMap<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reload() {
|
||||||
|
this.loadUserPermissions();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void loadUserPermissions() {
|
||||||
|
String onlineHabbos = "";
|
||||||
|
for(Habbo habbo: Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().values()) {
|
||||||
|
onlineHabbos += habbo.getHabboInfo().getId() + ", ";
|
||||||
|
}
|
||||||
|
onlineHabbos = onlineHabbos.substring(0, onlineHabbos.length() - 2);
|
||||||
|
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT * FROM user_permissions WHERE user_id IN (?)")) {
|
||||||
|
statement.setString(1, onlineHabbos);
|
||||||
|
try (ResultSet set = statement.executeQuery()) {
|
||||||
|
while (set.next()) {
|
||||||
|
UserRank userRank;
|
||||||
|
if (!this.userRanks.containsKey(set.getInt("user_id"))) {
|
||||||
|
userRank = new UserRank(set);
|
||||||
|
this.userRanks.put(set.getInt("user_id"), userRank);
|
||||||
|
} else {
|
||||||
|
userRank = this.userRanks.get(set.getInt("user_id"));
|
||||||
|
userRank.load(set);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
Emulator.getLogging().logSQLException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void loadPermissionsForHabbo(Habbo habbo) {
|
||||||
|
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT * FROM user_permissions WHERE user_id = ? LIMIT 1")) {
|
||||||
|
statement.setInt(1, habbo.getHabboInfo().getId());
|
||||||
|
try (ResultSet set = statement.executeQuery()) {
|
||||||
|
if (set.next()) {
|
||||||
|
UserRank userRank;
|
||||||
|
if (!this.userRanks.containsKey(set.getInt("user_id"))) {
|
||||||
|
userRank = new UserRank(set);
|
||||||
|
this.userRanks.put(set.getInt("user_id"), userRank);
|
||||||
|
} else {
|
||||||
|
userRank = this.userRanks.get(set.getInt("user_id"));
|
||||||
|
userRank.load(set);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
Emulator.getLogging().logSQLException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void unloadPermissionsForHabbo(Habbo habbo) {
|
||||||
|
if (this.userRanks.containsKey(habbo.getHabboInfo().getId())) {
|
||||||
|
this.userRanks.remove(habbo.getHabboInfo().getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public UserRank getUserRank(int userId) {
|
||||||
|
return this.userRanks.get(userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasPermission(Habbo habbo, String permission, boolean withRoomRights) {
|
||||||
|
if (this.userRanks.containsKey(habbo.getHabboInfo().getId())) {
|
||||||
|
return this.getUserRank(habbo.getClient().getHabbo().getHabboInfo().getId()).hasPermission(permission, withRoomRights);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean permissionIgnored(Habbo habbo, String permission) {
|
||||||
|
if (this.userRanks.containsKey(habbo.getHabboInfo().getId())) {
|
||||||
|
return this.getUserRank(habbo.getClient().getHabbo().getHabboInfo().getId()).permissionIgnored(permission);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean userExists(int userId) {
|
||||||
|
return this.userRanks.containsKey(userId);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,64 @@
|
|||||||
|
package com.eu.habbo.habbohotel.permissions;
|
||||||
|
|
||||||
|
import gnu.trove.map.hash.THashMap;
|
||||||
|
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.ResultSetMetaData;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
|
||||||
|
public class UserRank {
|
||||||
|
|
||||||
|
private final int user_id;
|
||||||
|
|
||||||
|
private final THashMap<String, UserPermission> permissions;
|
||||||
|
private final THashMap<String, String> variables;
|
||||||
|
|
||||||
|
public UserRank(ResultSet set) throws SQLException {
|
||||||
|
this.permissions = new THashMap<>();
|
||||||
|
this.variables = new THashMap<>();
|
||||||
|
this.user_id = set.getInt("user_id");
|
||||||
|
|
||||||
|
this.load(set);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void load(ResultSet set) throws SQLException {
|
||||||
|
ResultSetMetaData meta = set.getMetaData();
|
||||||
|
for (int i = 1; i < meta.getColumnCount() + 1; i++) {
|
||||||
|
String columnName = meta.getColumnName(i);
|
||||||
|
if (columnName.startsWith("cmd_") || columnName.startsWith("acc_")) {
|
||||||
|
this.permissions.put(meta.getColumnName(i), new UserPermission(columnName, UserPermissionSetting.fromString(set.getString(i))));
|
||||||
|
} else {
|
||||||
|
this.variables.put(meta.getColumnName(i), set.getString(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasPermission(String key, boolean isRoomOwner) {
|
||||||
|
if (this.permissions.containsKey(key)) {
|
||||||
|
UserPermission permission = this.permissions.get(key);
|
||||||
|
|
||||||
|
return permission.setting == UserPermissionSetting.ALLOWED || permission.setting == UserPermissionSetting.ROOM_OWNER && isRoomOwner;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean permissionIgnored(String key) {
|
||||||
|
if (this.permissions.containsKey(key)) {
|
||||||
|
UserPermission permission = this.permissions.get(key);
|
||||||
|
return permission.setting == UserPermissionSetting.IGNORED;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public THashMap<String, UserPermission> getPermissions() {
|
||||||
|
return this.permissions;
|
||||||
|
}
|
||||||
|
|
||||||
|
public THashMap<String, String> getVariables() {
|
||||||
|
return this.variables;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -173,6 +173,7 @@ public class Habbo implements Runnable {
|
|||||||
return;
|
return;
|
||||||
} finally {
|
} finally {
|
||||||
Emulator.getGameEnvironment().getRoomManager().unloadRoomsForHabbo(this);
|
Emulator.getGameEnvironment().getRoomManager().unloadRoomsForHabbo(this);
|
||||||
|
Emulator.getGameEnvironment().getUserPermissionsManager().unloadPermissionsForHabbo(this);
|
||||||
Emulator.getGameEnvironment().getHabboManager().removeHabbo(this);
|
Emulator.getGameEnvironment().getHabboManager().removeHabbo(this);
|
||||||
}
|
}
|
||||||
LOGGER.info("{} disconnected.", this.habboInfo.getUsername());
|
LOGGER.info("{} disconnected.", this.habboInfo.getUsername());
|
||||||
@ -197,6 +198,13 @@ public class Habbo implements Runnable {
|
|||||||
return Emulator.getGameEnvironment().getPermissionsManager().hasPermission(this, key, hasRoomRights);
|
return Emulator.getGameEnvironment().getPermissionsManager().hasPermission(this, key, hasRoomRights);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean hasUserPermission(String key, boolean hasRoomRights) {
|
||||||
|
return Emulator.getGameEnvironment().getUserPermissionsManager().hasPermission(this, key, hasRoomRights);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean permissionIgnored(String key) {
|
||||||
|
return Emulator.getGameEnvironment().getUserPermissionsManager().permissionIgnored(this, key);
|
||||||
|
}
|
||||||
|
|
||||||
public void giveCredits(int credits) {
|
public void giveCredits(int credits) {
|
||||||
if (credits == 0)
|
if (credits == 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user