Add basic support for managing, and accepting API tokens
also various other changes in pursuit of that. so far tokens are only accepted by web API and not traditional web app
This commit is contained in:
parent
85947878c4
commit
c002d3d182
9 changed files with 318 additions and 26 deletions
|
@ -2282,9 +2282,15 @@ class MasterView(View):
|
|||
if info and info.markdown_text:
|
||||
return info.markdown_text
|
||||
|
||||
def can_edit_help(self):
|
||||
if self.has_perm('edit_help'):
|
||||
return True
|
||||
if self.request.has_perm('common.edit_help'):
|
||||
return True
|
||||
return False
|
||||
|
||||
def edit_help(self):
|
||||
if (not self.has_perm('edit_help')
|
||||
and not self.request.has_perm('common.edit_help')):
|
||||
if not self.can_edit_help():
|
||||
raise self.forbidden()
|
||||
|
||||
model = self.model
|
||||
|
@ -2317,8 +2323,7 @@ class MasterView(View):
|
|||
return {'ok': True}
|
||||
|
||||
def edit_field_help(self):
|
||||
if (not self.has_perm('edit_help')
|
||||
and not self.request.has_perm('common.edit_help')):
|
||||
if not self.can_edit_help():
|
||||
raise self.forbidden()
|
||||
|
||||
model = self.model
|
||||
|
@ -2371,8 +2376,7 @@ class MasterView(View):
|
|||
'grid_index': self.grid_index,
|
||||
'help_url': self.get_help_url(),
|
||||
'help_markdown': self.get_help_markdown(),
|
||||
'can_edit_help': (self.has_perm('edit_help')
|
||||
or self.request.has_perm('common.edit_help')),
|
||||
'can_edit_help': self.can_edit_help(),
|
||||
'quickie': None,
|
||||
}
|
||||
|
||||
|
@ -2638,16 +2642,16 @@ class MasterView(View):
|
|||
elif is_primary:
|
||||
btn_kw['type'] = 'is-primary'
|
||||
|
||||
if icon_left:
|
||||
btn_kw['icon_left'] = icon_left
|
||||
elif is_external:
|
||||
btn_kw['icon_left'] = 'external-link-alt'
|
||||
elif url:
|
||||
btn_kw['icon_left'] = 'eye'
|
||||
|
||||
if url:
|
||||
btn_kw['href'] = url
|
||||
|
||||
if icon_left:
|
||||
btn_kw['icon_left'] = icon_left
|
||||
elif is_external:
|
||||
btn_kw['icon_left'] = 'external-link-alt'
|
||||
else:
|
||||
btn_kw['icon_left'] = 'eye'
|
||||
|
||||
if target:
|
||||
btn_kw['target'] = target
|
||||
elif is_external:
|
||||
|
@ -4017,8 +4021,7 @@ class MasterView(View):
|
|||
'action_url': self.request.current_route_url(_query=None),
|
||||
'assume_local_times': self.has_local_times,
|
||||
'route_prefix': route_prefix,
|
||||
'can_edit_help': (self.has_perm('edit_help')
|
||||
or self.request.has_perm('common.edit_help')),
|
||||
'can_edit_help': self.can_edit_help(),
|
||||
}
|
||||
|
||||
if defaults['can_edit_help']:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue