Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Permission system #25

Closed
Spcemarine opened this issue Jan 29, 2015 · 9 comments
Closed

Permission system #25

Spcemarine opened this issue Jan 29, 2015 · 9 comments
Assignees

Comments

@Spcemarine
Copy link
Collaborator

The commands get "permission levels" ("security level" would be also fine by me) and the players get such a level. The levels are integers (maybe unsigned, but we could use < 0 for special purposes).The player can execute a command that's below or equal to his level. By default we set commands for users to 0 and commands for admins to 100 and so are the levels for the admins and users. When a player connects to the server, all the commands are set to 100 and the players level is 0 so that he can't do anything until he has received his level and the levels of the commands from the server.
Furthermore we can implement groups that have a name, a level and that contain players, so that the admin can setup the group "Mods" with level 50 and give them the right to use forcekick, listships, tp, tpp, etc.
And to top that we can implement certain "exceptional" permissions that can be set for each player, so that the server tells the client of one of the mods that the level for forcekick is 100 because he has abused it and the admin doesn't want him to use it anymore.

Why change the current system?
We do not really need to change it. But I think it would be easier with the other concept

@Spcemarine Spcemarine self-assigned this Jan 29, 2015
Spcemarine added a commit that referenced this issue Feb 3, 2015
Preparation for saving cfg #25.
Config is serialized as XML now.
Added possibility to show motd in chat instead of mission screen.
@Spcemarine
Copy link
Collaborator Author

Just updated the first post because I don't like my first idea anymore. I hope the new concept is understandable. Let me now what you think about it.

@midspace
Copy link
Owner

midspace commented Mar 1, 2015

I'm with some internet now.
Multiple levels make sense, I'm just not sure about and unsigned integer.
Enums can represent levels just the same, with a name.

@Spcemarine
Copy link
Collaborator Author

Yes, but I want the admins to be able to create the groups, not only to organize them. If we use enums, we need to predefine the groups, right? I want to give the admins more flexibility. I don't want to predefine anything except for default values.

@midspace
Copy link
Owner

midspace commented Mar 2, 2015

Custom groups. Yes, that make a lot more sense. Every command will need to be defined in the configuration.

Spcemarine added a commit that referenced this issue Mar 25, 2015
Changed ChatCommandSecurity to uint
- Users have level 0, Admins level 100.
- For commands that are in development there is a experimental flag.
Refined handling of connection requests.
Spcemarine added a commit that referenced this issue Mar 29, 2015
- clients will receive their permissions when they join
- any command executions are blocked until they received all the
security information
- added config setting "AdminLevel" this will define the default level
of a server admin (default value is ChatCommandSecurity.Admin)
- commands will be registered in only one dictionary in order to
simplify the process of updating the command security
- commands use the command name as a unique id
- if ChatCommand.Invoke() returns false the client will get displayed
the brief help #41
- /cfg and /msg will tell the user that they can not be used in offline
mode
@Spcemarine
Copy link
Collaborator Author

Below there is the help of the /perm command. Would you agree that it might be better to make a command for each domain? {0} = player name


This command is used for organizing the permissions ingame.

Syntax:
/perm < domain > < action > [< subject > [< parameter >]]

Domains:

command, player, group

Each domain has specific actions. See below:

Actions:

  • For 'command':
    setlevel:
    Sets the needed level for a command to the specified level.
    Example: /perm command setlevel help 100

    list (not implemented yet):
    Creates a hotlist containing all commands and provides information about the needed level of the commands.

  • For 'player':
    setlevel:
    Sets the level of a player to the specified value. Remind that you have to set useplayerlevel to true otherwise using this won't make any difference.
    Example: /perm player setlevel {0} 150

    extend:
    Grants the specified player to use the specified command regardless of his level. When a player has extended rights use 'restrict' to restore normal permissions. When a player has restricted rights you can use this command to restore normal permissions.
    Example: /perm player extend {0} tp
    -> If the player had normal access to the command, he will be able to use it from now regardless of his level. If the player had restricted access to the command he will have normal access from now.

    restrict:
    Prevents the specified player from using the specified command regardless of his level. When a player has restricted rights use 'extend' to restore normal permissions. When a player has extended rights you can use this command to restore normal permissions.
    Example: /perm player restrict {0} tp
    -> If the player had normal access to the command, he won't be able to use it any longer regardless of his level. If the player had extended access to the command he will have normal access from now.

    useplayerlevel:
    If set to true the level of the player will be used. By default it is false.
    Example: /perm player useplayerlevel {0} true

    list (not implemented yet):
    Creates a hotlist containing all players and provides information about them.

  • For 'group':
    setlevel:
    Sets the level of a group to the specified value.
    Example: /perm group setlevel mygroup 150

    setname:
    Sets the name of a group to the specified value.
    Example: /perm group setname mygroup mynewgroupname

    add:
    Adds the specified player to the specified group.
    Example: /perm group add mygroup {0}

    remove:
    Removes the specified player from the specified group.
    Example: /perm group remove mygroup {0}

    create:
    Creates a new group with a specified name and a specified level
    Example: /perm group create mygroup 150

    delete:
    Deletes the specified group.
    Example: /perm group delete mygroup

    list (not implemented yet):
    Creates a hotlist containing all groups and provides information about them.

@midspace
Copy link
Owner

midspace commented May 1, 2015

A single command does make it easier to remember.
We could just alias the commands, and make both options available.

@Spcemarine
Copy link
Collaborator Author

That's true it is easier to remember but it felt unnecessary to type in '/perm' all the time while you have to specify which domain you want to use.
Creating aliases could be an option but I'll do that later. Implementing the hotlists is more important.

Spcemarine added a commit that referenced this issue May 2, 2015
- Implemented /perm, see the command help for a descriptiom
Spcemarine added a commit that referenced this issue May 7, 2015
- permissions were not sent to the client in several cases
- added message when the level of a command was changed
- fixed some typos
@Spcemarine
Copy link
Collaborator Author

In case you want to release the permissions with the fix, you can use the doc below. At the moment I consider the permission feature as work in progress because it lacks some features but it is usable, at least I don't find bugs anymore. So why not releasing it?


Permissions (WIP)
Players and commands have certain levels. A level is a positive number from 0 to 4,294,967,295. A player can not use a command that has a higher level than his own level. The default administrator level can be set in the config and is set to 100 by default. Normal users have a default level of 0. The default level for admin commands is also set to 100 but the default value can not be changed. The user commands have the level 0.
Moreover custom groups can be created that have a level and members. All members will have the level of the group. If a player is member of several groups he will get the level of the group with the highest level. Furthermore the player himself has a level that must be activated by setting "useplayerlevel" to true, otherwise the group level or, if the player is not member of any group, the default level will be used.
Additionally you can extend the rights of a specific player for a specific command, i.e. the player will always have access to the command regardless of any levels. The contrary, restrictions of certain commands, is also available. For further instructions on how organize permissions, use "/help perm".
Note: This version of permissions is considered as work in progress.

Spcemarine added a commit that referenced this issue May 10, 2015
- added hotlists for commands, players and groups
- added adminlevel to /cfg command
- player entries in permissions will be updated when a player changes
his name
- fixed crash when someone tries to change the level of a command while
a player is online who has not been added to the permissions file yet
- permissions were not saved after creating a group
@Spcemarine
Copy link
Collaborator Author

You can remove the "WIP" now and the note at the bottom now.
Do you think we should mention the hotlists in the description?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants