mirror of
https://github.com/fastogt/fastocloud_admin.git
synced 2025-03-09 23:38:52 +00:00
User type
This commit is contained in:
parent
4b1911695f
commit
46bdefd2ef
5 changed files with 14 additions and 3 deletions
|
@ -1,3 +1,7 @@
|
|||
1.1.0 /
|
||||
[Alexandr Topilski]
|
||||
- User type
|
||||
|
||||
1.0.0 / June 1, 2019
|
||||
[Alexandr Topilski]
|
||||
- Service version
|
||||
|
|
|
@ -24,11 +24,16 @@ class User(UserMixin, Document):
|
|||
ACTIVE = 1
|
||||
BANNED = 2
|
||||
|
||||
class Type(IntEnum):
|
||||
GUEST = 0,
|
||||
USER = 1
|
||||
|
||||
meta = {'collection': 'users', 'auto_create_index': False}
|
||||
email = StringField(max_length=30, required=True)
|
||||
password = StringField(required=True)
|
||||
created_date = DateTimeField(default=datetime.now)
|
||||
status = IntField(default=Status.NO_ACTIVE)
|
||||
type = IntField(default=Type.USER)
|
||||
|
||||
settings = EmbeddedDocumentField(Settings, default=Settings)
|
||||
servers = ListField(ReferenceField(ServiceSettings), default=[])
|
||||
|
|
|
@ -63,7 +63,7 @@ class UploadM3uForm(FlaskForm):
|
|||
submit = SubmitField(lazy_gettext(u'Upload'))
|
||||
|
||||
|
||||
class UserAddForm(FlaskForm):
|
||||
class UserServerForm(FlaskForm):
|
||||
AVAILABLE_ROLES = [(constants.Roles.READ, 'Read'), (constants.Roles.WRITE, 'Write'),
|
||||
(constants.Roles.ADMIN, 'Admin'), (constants.Roles.SUPPORT, 'Support')]
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ from flask import render_template, redirect, url_for, request, jsonify
|
|||
from flask_login import login_required, current_user
|
||||
|
||||
from app import get_runtime_folder
|
||||
from app.service.forms import ServiceSettingsForm, ActivateForm, UploadM3uForm, UserAddForm
|
||||
from app.service.forms import ServiceSettingsForm, ActivateForm, UploadM3uForm, UserServerForm
|
||||
from app.service.service_entry import ServiceSettings, UserPair
|
||||
from app.utils.m3u_parser import M3uParser
|
||||
from app.home.user_loging_manager import User
|
||||
|
@ -143,7 +143,7 @@ class ServiceView(FlaskView):
|
|||
@login_required
|
||||
@route('/user/add/<sid>', methods=['GET', 'POST'])
|
||||
def user_add(self, sid):
|
||||
form = UserAddForm()
|
||||
form = UserServerForm()
|
||||
if request.method == 'POST' and form.validate_on_submit():
|
||||
user = User.objects(email=form.email.data).first()
|
||||
server = ServiceSettings.objects(id=sid).first()
|
||||
|
|
|
@ -65,11 +65,13 @@ Dashboard | {{ config['PUBLIC_CONFIG'].site.title }}
|
|||
{% trans %}Logout{% endtrans %}
|
||||
</a>
|
||||
</div>
|
||||
{% if (current_user.type != 0) %}
|
||||
<div class="col-md-1">
|
||||
<a href="{{ url_for('UserView:remove') }}" class="btn btn-danger" role="button">
|
||||
{% trans %}Delete{% endtrans %}
|
||||
</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="row well">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue