Manic Digger

It is currently Tue Oct 24, 2017 4:07 am

All times are UTC




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Introducing flexible groups and privileges to Manic Digger
PostPosted: Wed Mar 28, 2012 3:14 pm 
Offline

Joined: Fri Jul 08, 2011 10:55 pm
Posts: 159
Location: Karlsruhe, Germany
Hi,

at the moment, I am editing the Manic Digger server. I try make it more flexible and add new features for server hosters (e.g. a console command interpreter, interfaces which can be accessed by shell scripts, for example to get safe database backups). Maybe I'm going to host a MD server again soon.

The first major change is concerning the MD ranks. As you know, there are 3 MD ranks (+Moderator in nightly):
  • Guest: default rank, no privileges
  • Builder: standard rank for antivandal side, no privileges
  • Admin: all privileges

While I was hosting a server, I often wished I had additional ranks available and a bigger gradation in privileges. A lot of players were begging for admin rank but I didn't want to give them access to all server commands (they were too inexperienced or would abuse commands). Other builders were asking to get kick privilege to expel griefers from the server, when there is no admin on. There are no possibilities to adjust these ranks in the server's config file, because ranks rigid and hardcoded in the program.

So I took a concept from other games, server extensions and programs: flexible groups and privileges.
This allows you to define new user group with certain privileges and add users to it without changing the source code.

Here's how it works:
All server client related settings are now managed by a new XML config file, ServerClient.xml. It is similar the ServerConfig.xml.
Inside it, you define groups and associated variables like a group color and of course the privileges. Privileges correspond with server commands + general chat and build right. After that, you assign users to your groups. This replaces the <Admins> and <Builders> sections in the ServerConfig.xml.

Groups
This is a structure of a group:
Code:
<Group>
  <Name>Guest</Name>
  <Level>0</Level>
  <GroupPrivileges>
    <Privilege>chat</Privilege>
    <Privilege>pm</Privilege>
    <Privilege>build</Privilege>
    <Privilege>login</Privilege>
  </GroupPrivileges>
  <GroupColor>Cyan</GroupColor>
</Group>

This group is equal to the "Guest" rank. The attribute "Level" is used to form a hierarchy (more on this later). The group's privileges are self-explanatory. There is a list with all available privileges in the following.
Furthermore, a group has a variable "GroupColor". The names of group's members are being displayed in this color e.g. in chat messages. A list with the available colors is also in the following.

Two more examples:
Code:
<Group>
  <Name>Admin</Name>
  <Level>2</Level>
  <Password>admin</Password>
  <GroupPrivileges>
    <Privilege>chat</Privilege>
    <Privilege>pm</Privilege>
    <Privilege>build</Privilege>
    <Privilege>kick</Privilege>
    <Privilege>ban</Privilege>
    ....
  </GroupPrivileges>
  <GroupColor>Yellow</GroupColor>
</Group>

<Group>
  <Name>SuperAdmin</Name>
  <Level>3</Level>
  <Password>super</Password>
  <GroupPrivileges>
    <Privilege>chat</Privilege>
    <Privilege>pm</Privilege>
    <Privilege>build</Privilege>
    <Privilege>kick</Privilege>
    <Privilege>kick_id</Privilege>
    <Privilege>ban</Privilege>
    <Privilege>ban_id</Privilege>
    ... (more privileges than Admin)
  </GroupPrivileges>
  <GroupColor>Red</GroupColor>
</Group>

As you can see, "SuperAdmin" has a higher level than "Admin". That means, "SuperAdmin" is superior "Admin".
Both have the privilege to kick, but a member of "Admin" won't be able to kick a "SuperAdmin" member, because his level is higher. This should protect against abusing server commands.
Furthermore, there is a new variable "Password". It is an optional attribute of a group. If it is set, clients are able to temporary change their group to it, with the password, if they have the privilege "login".

After defining groups, you assign players (clients) to it:
Code:
<Client>
  <Name>Rnd</Name>
  <Group>Admin</Group>
</Client>

At the moment, a client can only be member of one group.


The "ServerClient.xml" has two additional attributes:
Code:
<DefaultGroupGuests>Guest</DefaultGroupGuests>
<DefaultGroupRegistered>Registered</DefaultGroupRegistered>

These decide in which group new unknown clients are being put when they connect. The used groups must be defined in the config file. Otherwise, the server stops.

By default, the following "ServerClient.xm" is being generated.
It contains groups which are equivalent to the current MD ranks.
Code:
<?xml version="1.0" encoding="utf-8"?>
<ManicDiggerServerClient xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <Format>1</Format>
  <DefaultGroupGuests>Guest</DefaultGroupGuests>
  <DefaultGroupRegistered>Registered</DefaultGroupRegistered>
  <Groups>
    <Group>
      <Name>Registered</Name>
      <Level>0</Level>
      <Password xsi:nil="true" />
      <GroupPrivileges>
        <Privilege>chat</Privilege>
        <Privilege>pm</Privilege>
        <Privilege>build</Privilege>
      </GroupPrivileges>
      <GroupColor>Cyan</GroupColor>
    </Group>
    <Group>
      <Name>Guest</Name>
      <Level>0</Level>
      <Password xsi:nil="true" />
      <GroupPrivileges>
        <Privilege>chat</Privilege>
        <Privilege>pm</Privilege>
        <Privilege>build</Privilege>
      </GroupPrivileges>
      <GroupColor>Cyan</GroupColor>
    </Group>
    <Group>
      <Name>Builder</Name>
      <Level>1</Level>
      <Password xsi:nil="true" />
      <GroupPrivileges>
        <Privilege>chat</Privilege>
        <Privilege>pm</Privilege>
        <Privilege>build</Privilege>
      </GroupPrivileges>
      <GroupColor>Green</GroupColor>
    </Group>
    <Group>
      <Name>Admin</Name>
      <Level>2</Level>
      <Password xsi:nil="true" />
      <GroupPrivileges>
        <Privilege>chat</Privilege>
        <Privilege>pm</Privilege>
        <Privilege>build</Privilege>
        <Privilege>kick</Privilege>
        <Privilege>ban</Privilege>
        <Privilege>unban</Privilege>
        <Privilege>announcement</Privilege>
        <Privilege>welcome</Privilege>
        <Privilege>list_clients</Privilege>
        <Privilege>list_saved_clients</Privilege>
        <Privilege>list_groups</Privilege>
        <Privilege>list_banned_users</Privilege>
        <Privilege>list_areas</Privilege>
        <Privilege>chgrp</Privilege>
        <Privilege>monsters</Privilege>
        <Privilege>give</Privilege>
        <Privilege>giveall</Privilege>
      </GroupPrivileges>
      <GroupColor>Yellow</GroupColor>
    </Group>
  </Groups>
  <Clients>
    <Client>
      <Name>Player name?</Name>
      <Group>Registered</Group>
    </Client>
  </Clients>
</ManicDiggerServerClient>



Privileges
Current available privileges
Code:
public enum Privilege
{
    build,
    chat,
    pm,
    kick,
    kick_id,
    ban,
    ban_id,
    banip,
    banip_id,
    unban,
    run,
    chgrp,
    login,
    welcome,
    logging,
    list_clients,
    list_saved_clients,
    list_groups,
    list_banned_users,
    list_areas,
    give,
    giveall,
    monsters,
    announcement
};



GroupColors
Available group colors:
Code:
public enum ClientColor
{
    White,
    Black,
    Red,
    Green,
    Blue,
    Yellow,
    Cyan,
    Purple,
    Grey
};



Areas
To make the group system work, I had to make little changes on the area definitions.
Here's the new format:
Code:
<Area>
  <PermittedGroups>
    <Group>Guest</Group>
    <Group>Registered</Group>
  </PermittedGroups>
  <PermittedUsers>
    <User>Rnd</User>
  </PermittedUsers>
  <Coords>0,0,10000,5000</Coords>
</Area>

"PermittedGroups" as well as "PermittedUsers" are optional.


Notes about groups and privileges
This is just a first draft of a new group and privilege system. Further enhancements are planned:
  • multiple group membership
  • separate client privileges which can override group privileges
  • in-game assigning privileges (e.g. removing chat privilege to mute someone)
  • individual client playername colors


Notes about the patch
The patch contains some additional changes (e.g. my old patches which not have been applied yet). It's based on the current (2012-02-16) GIT version. Don't apply my old patches.
Here the changes in detail:
  • Server enhancements:
    • introduced groups and privileges
    • encapsulate server commands (reworked many, added command interpreter)
    • added some script commands
    • added a simple server console command line interpreter (first draft, chat only).
  • Bugfixes:
    • game doesn't crash when lighting tnt on map ground
    • allow to place tnt on max. map height
    • don't allow to place doors at max. map height (game crashes, because a door has a height of 2 blocks)
  • Clean-up operation:
    • merged Minecraft and MD tiles (enum TileType..)
  • Miscellaneous:
    • ScriptConsole.cs had to be formatted (incompatible in MonoDevelop)
    • some references had to be added (System.Action instead of Action)
    • HUDPlayerList will be implemented soon, showing a better player list with additional information (privileges, groups, ids, pings(?))


Attachments:
server2.patch [180.61 KiB]
Downloaded 75 times


Last edited by YoDigger on Thu Mar 29, 2012 12:45 am, edited 1 time in total.
Top
 Profile  
 
 Post subject: Re: Introducing flexible groups and privileges to Manic Digg
PostPosted: Wed Mar 28, 2012 5:01 pm 
Offline
User avatar

Joined: Wed Feb 22, 2012 4:17 pm
Posts: 381
Sounds VERY interesting so far!
Is it possible to make the server suitable for a GUI? (with available command line arguments for updating config while running, restarting, etc.)
I'll try to do a possible design - but I don't have experience with generating XML files...

Greets,
croxxx

_________________
Manic Digger Developer and Forum Moderator
Founder of the Pixolia Network

For mod updates (and other ocassional ramblings) follow me on Twitter: @THEcroxxx
Sometimes streaming stuff on Twitch
Homepage: croxxx.tk


Top
 Profile  
 
 Post subject: Re: Introducing flexible groups and privileges to Manic Digg
PostPosted: Wed Mar 28, 2012 6:09 pm 
Offline

Joined: Fri Jul 08, 2011 10:55 pm
Posts: 159
Location: Karlsruhe, Germany
Hi,

Land Warrior was working on a server GUI. I don't know how far he came and what happened to it. I haven't tried it yet.
See his branch in GIT repository.
I would like to see a server GUI in official MD someday. However I'll have to stick with the console on my Linux server without a graphical environment (SSH only).

Regards


Top
 Profile  
 
 Post subject: Re: Introducing flexible groups and privileges to Manic Digg
PostPosted: Wed Mar 28, 2012 7:27 pm 
Offline
User avatar

Joined: Wed Feb 22, 2012 4:17 pm
Posts: 381
Oh, you're right - I forgot about his work... :oops:
Here's what I put together on the fly.
Image
and
Image

This is JUST a CONCEPT - there's no working code behind it!

Regards,
croxxx

_________________
Manic Digger Developer and Forum Moderator
Founder of the Pixolia Network

For mod updates (and other ocassional ramblings) follow me on Twitter: @THEcroxxx
Sometimes streaming stuff on Twitch
Homepage: croxxx.tk


Top
 Profile  
 
 Post subject: Re: Introducing flexible groups and privileges to Manic Digg
PostPosted: Sat Mar 31, 2012 10:39 pm 
Offline
Site Admin

Joined: Mon Jun 21, 2010 12:02 pm
Posts: 394
Missing file?
Attachment:
server2.png
server2.png [ 27.32 KiB | Viewed 2302 times ]


Top
 Profile  
 
 Post subject: Re: Introducing flexible groups and privileges to Manic Digg
PostPosted: Sun Apr 01, 2012 11:17 pm 
Offline

Joined: Fri Jul 08, 2011 10:55 pm
Posts: 159
Location: Karlsruhe, Germany
Hi,

I checked the patch. All files should be included. The errors are related to classes which are in ServerClient.cs. The namespace is also correct (GameModeFortress).
I don't know what's wrong. However after you added Henon's JavaScript branch, I had a lot of reference errors, too. See here.
I am using MonoDevelop 2.6 under Ubuntu.
Here is a copy of my current MD project folder. Are you able to compile and run it? Here it works..

Regards.


Top
 Profile  
 
 Post subject: Re: Introducing flexible groups and privileges to Manic Digg
PostPosted: Sat Apr 14, 2012 4:40 am 
Offline
User avatar

Joined: Thu Mar 03, 2011 3:54 pm
Posts: 197
Oooh! I like this. Reminds me of running groups on Second Life. Definitely useful.

_________________
Manic Digger handle: Jethren
I need to rebuild my giant library!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group