- Implemented permission system management inside the game
- changed @chperm to @setperm to avoid confusion with channel commands - added @setgroup command for adding user group permissions - Moved permissions/group setup into settings file to allow admins to tweak without going into evennia engine. - Add all new players to default permission group (defined in settings) - Defined a basic group hierarchy, removed permission 'genperms.builder' in favour of a group named builders instead, containing all relevant permissions. - Filtered out all django's automatic permissions in @setperm/list to make permission system more controlled by admin. - Probably fixed bug that caused new users to not be signed up to channels (more testing needed) - Added Exception handler in unloggedin method create, this was killing tracebacks upon user creation. /Griatch
This commit is contained in:
parent
77f2186d9a
commit
7f7306a6e4
23 changed files with 341 additions and 214 deletions
|
|
@ -5,6 +5,7 @@ well as creating auto-docs of commands based on their doc strings.
|
|||
The system supports help-markup for multiple help entries as well
|
||||
as a dynamically updating help index.
|
||||
"""
|
||||
from django.contrib.auth.models import User
|
||||
from src.helpsys.models import HelpEntry
|
||||
from src.ansi import ANSITable
|
||||
|
||||
|
|
@ -44,7 +45,7 @@ def _create_help(topicstr, entrytext, staff_only=False, force_create=False,
|
|||
elif pobject:
|
||||
#checks access rights before searching (this should have been
|
||||
#done already at the command level)
|
||||
if not pobject.is_staff(): return []
|
||||
if not pobject.has_perm("helpsys.add_help"): return []
|
||||
topic = HelpEntry.objects.find_topicmatch(pobject, topicstr)
|
||||
else:
|
||||
return []
|
||||
|
|
@ -197,7 +198,8 @@ def get_help_index(pobject,filter=None):
|
|||
filter='staff' - view only staff-specific help files
|
||||
filter='player' - view only those files visible to all
|
||||
"""
|
||||
if pobject.is_staff():
|
||||
|
||||
if pobject.has_perm("helpsys.staff_help"):
|
||||
if filter == 'staff':
|
||||
helpentries = HelpEntry.objects.filter(staff_only=True).order_by('topicname')
|
||||
elif filter == 'player':
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
Models for the help system.
|
||||
"""
|
||||
from django.db import models
|
||||
from django.conf import settings
|
||||
from src import ansi
|
||||
from src.helpsys.managers import HelpEntryManager
|
||||
|
||||
|
|
@ -18,6 +19,7 @@ class HelpEntry(models.Model):
|
|||
class Meta:
|
||||
verbose_name_plural = "Help entries"
|
||||
ordering = ['topicname']
|
||||
permissions = settings.PERM_HELPSYS
|
||||
|
||||
def __str__(self):
|
||||
return self.topicname
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue