Commit 330c0785 authored by BaiJiangJie's avatar BaiJiangJie

[Update] Merge dev

parents 100dd24f 98d3a36d
...@@ -9,7 +9,7 @@ COPY ./requirements /tmp/requirements ...@@ -9,7 +9,7 @@ COPY ./requirements /tmp/requirements
RUN yum -y install epel-release && \ RUN yum -y install epel-release && \
echo -e "[mysql]\nname=mysql\nbaseurl=https://mirrors.tuna.tsinghua.edu.cn/mysql/yum/mysql57-community-el6/\ngpgcheck=0\nenabled=1" > /etc/yum.repos.d/mysql.repo echo -e "[mysql]\nname=mysql\nbaseurl=https://mirrors.tuna.tsinghua.edu.cn/mysql/yum/mysql57-community-el6/\ngpgcheck=0\nenabled=1" > /etc/yum.repos.d/mysql.repo
RUN cd /tmp/requirements && yum -y install $(cat rpm_requirements.txt) RUN cd /tmp/requirements && yum -y install $(cat rpm_requirements.txt)
RUN cd /tmp/requirements && pip install --upgrade pip setuptools && \ RUN cd /tmp/requirements && pip install --upgrade pip setuptools && pip install wheel && \
pip install -i https://mirrors.aliyun.com/pypi/simple/ -r requirements.txt || pip install -r requirements.txt pip install -i https://mirrors.aliyun.com/pypi/simple/ -r requirements.txt || pip install -r requirements.txt
RUN mkdir -p /root/.ssh/ && echo -e "Host *\n\tStrictHostKeyChecking no\n\tUserKnownHostsFile /dev/null" > /root/.ssh/config RUN mkdir -p /root/.ssh/ && echo -e "Host *\n\tStrictHostKeyChecking no\n\tUserKnownHostsFile /dev/null" > /root/.ssh/config
......
...@@ -16,6 +16,8 @@ __all__ = ['DomainViewSet', 'GatewayViewSet', "GatewayTestConnectionApi"] ...@@ -16,6 +16,8 @@ __all__ = ['DomainViewSet', 'GatewayViewSet', "GatewayTestConnectionApi"]
class DomainViewSet(OrgBulkModelViewSet): class DomainViewSet(OrgBulkModelViewSet):
model = Domain model = Domain
filter_fields = ("name", )
search_fields = filter_fields
permission_classes = (IsOrgAdminOrAppUser,) permission_classes = (IsOrgAdminOrAppUser,)
serializer_class = serializers.DomainSerializer serializer_class = serializers.DomainSerializer
...@@ -27,7 +29,7 @@ class DomainViewSet(OrgBulkModelViewSet): ...@@ -27,7 +29,7 @@ class DomainViewSet(OrgBulkModelViewSet):
class GatewayViewSet(OrgBulkModelViewSet): class GatewayViewSet(OrgBulkModelViewSet):
model = Gateway model = Gateway
filter_fields = ("domain__name", "name", "username", "ip", "domain") filter_fields = ("domain__name", "name", "username", "ip", "domain__id")
search_fields = filter_fields search_fields = filter_fields
permission_classes = (IsOrgAdmin,) permission_classes = (IsOrgAdmin,)
serializer_class = serializers.GatewaySerializer serializer_class = serializers.GatewaySerializer
......
...@@ -63,7 +63,7 @@ class Gateway(AssetUser): ...@@ -63,7 +63,7 @@ class Gateway(AssetUser):
def test_connective(self, local_port=None): def test_connective(self, local_port=None):
if local_port is None: if local_port is None:
local_port = self.port local_port = self.port
if not re.match(r'\w+$', self.password): if self.password and not re.match(r'\w+$', self.password):
return False, _("Password should not contain special characters") return False, _("Password should not contain special characters")
client = paramiko.SSHClient() client = paramiko.SSHClient()
......
...@@ -20,6 +20,8 @@ __all__ = [ ...@@ -20,6 +20,8 @@ __all__ = [
class TaskViewSet(viewsets.ModelViewSet): class TaskViewSet(viewsets.ModelViewSet):
queryset = Task.objects.all() queryset = Task.objects.all()
filter_fields = ("name",)
search_fields = filter_fields
serializer_class = TaskSerializer serializer_class = TaskSerializer
permission_classes = (IsOrgAdmin,) permission_classes = (IsOrgAdmin,)
......
...@@ -130,6 +130,11 @@ class Organization(models.Model): ...@@ -130,6 +130,11 @@ class Organization(models.Model):
return True return True
return False return False
def can_user_by(self, user):
if self.get_org_users().filter(id=user.id):
return True
return False
def is_real(self): def is_real(self):
return self.id not in (self.DEFAULT_NAME, self.ROOT_ID, self.SYSTEM_ID) return self.id not in (self.DEFAULT_NAME, self.ROOT_ID, self.SYSTEM_ID)
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
define(['elfinder'], factory);
} else if (typeof exports !== 'undefined') {
module.exports = factory(require('elfinder'));
} else {
factory(root.elFinder);
}
}(this, function(elFinder) {
"use strict";
try {
if (! elFinder.prototype.commands.quicklook.plugins) {
elFinder.prototype.commands.quicklook.plugins = [];
}
elFinder.prototype.commands.quicklook.plugins.push(function(ql) {
var fm = ql.fm,
preview = ql.preview;
preview.on('update', function(e) {
var win = ql.window,
file = e.file, node, loading;
if (file.mime.indexOf('application/vnd.google-apps.') === 0) {
if (file.url == '1') {
preview.hide();
$('<div class="elfinder-quicklook-info-data"><button class="elfinder-info-button">'+fm.i18n('getLink')+'</button></div>').appendTo(ql.info.find('.elfinder-quicklook-info'))
.on('click', function() {
$(this).html('<span class="elfinder-spinner">');
fm.request({
data : {cmd : 'url', target : file.hash},
preventDefault : true
})
.always(function() {
preview.show();
$(this).html('');
})
.done(function(data) {
var rfile = fm.file(file.hash);
ql.value.url = rfile.url = data.url || '';
if (ql.value.url) {
preview.trigger($.Event('update', {file : ql.value}));
}
});
});
}
if (file.url !== '' && file.url != '1') {
e.stopImmediatePropagation();
loading = $('<div class="elfinder-quicklook-info-data"><span class="elfinder-spinner-text">'+fm.i18n('nowLoading')+'</span><span class="elfinder-spinner"/></div>').appendTo(ql.info.find('.elfinder-quicklook-info'));
node = $('<iframe class="elfinder-quicklook-preview-iframe"/>')
.css('background-color', 'transparent')
.on('load', function() {
ql.hideinfo();
loading.remove();
node.css('background-color', '#fff');
})
.on('error', function() {
loading.remove();
node.remove();
})
.appendTo(preview)
.attr('src', fm.url(file.hash));
preview.one('change', function() {
loading.remove();
node.off('load').remove();
});
}
}
});
});
} catch(e) {}
}));
!function(e,n){"function"==typeof define&&define.amd?define(["elfinder"],n):"undefined"!=typeof exports?module.exports=n(require("elfinder")):n(e.elFinder)}(this,function(e){"use strict";try{e.prototype.commands.quicklook.plugins||(e.prototype.commands.quicklook.plugins=[]),e.prototype.commands.quicklook.plugins.push(function(e){var n=e.fm,o=e.preview;o.on("update",function(i){var r,t,a=(e.window,i.file);0===a.mime.indexOf("application/vnd.google-apps.")&&("1"==a.url&&(o.hide(),$('<div class="elfinder-quicklook-info-data"><button class="elfinder-info-button">'+n.i18n("getLink")+"</button></div>").appendTo(e.info.find(".elfinder-quicklook-info")).on("click",function(){$(this).html('<span class="elfinder-spinner">'),n.request({data:{cmd:"url",target:a.hash},preventDefault:!0}).always(function(){o.show(),$(this).html("")}).done(function(i){var r=n.file(a.hash);e.value.url=r.url=i.url||"",e.value.url&&o.trigger($.Event("update",{file:e.value}))})})),""!==a.url&&"1"!=a.url&&(i.stopImmediatePropagation(),t=$('<div class="elfinder-quicklook-info-data"><span class="elfinder-spinner-text">'+n.i18n("nowLoading")+'</span><span class="elfinder-spinner"/></div>').appendTo(e.info.find(".elfinder-quicklook-info")),r=$('<iframe class="elfinder-quicklook-preview-iframe"/>').css("background-color","transparent").on("load",function(){e.hideinfo(),t.remove(),r.css("background-color","#fff")}).on("error",function(){t.remove(),r.remove()}).appendTo(o).attr("src",n.url(a.hash)),o.one("change",function(){t.remove(),r.off("load").remove()})))})})}catch(n){}});
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
(function(factory) {
if (typeof define === 'function' && define.amd) {
define(factory);
} else if (typeof exports !== 'undefined') {
module.exports = factory();
} else {
factory();
}
}(this, function() {
return void 0;
}));
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment