本文整理汇总了Python中seaserv.is_passwd_set函数的典型用法代码示例。如果您正苦于以下问题:Python is_passwd_set函数的具体用法?Python is_passwd_set怎么用?Python is_passwd_set使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了is_passwd_set函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: remove_repo_passwds
def remove_repo_passwds(self):
"""
Remove all repo decryption passwords stored on server.
"""
owned_repos, shared_repos, groups_repos = get_user_repos(self)
def has_repo(repos, repo):
for r in repos:
if repo.id == r.id:
return True
return False
passwd_setted_repos = []
for r in owned_repos + groups_repos:
if not has_repo(passwd_setted_repos, r) and r.encrypted and \
is_passwd_set(r.id, self.email):
passwd_setted_repos.append(r)
for r in shared_repos:
# For compatibility with diffrent fields names in Repo and
# SharedRepo objects.
r.id = r.repo_id
r.name = r.repo_name
r.desc = r.repo_desc
if not has_repo(passwd_setted_repos, r) and r.encrypted and \
is_passwd_set(r.id, self.email):
passwd_setted_repos.append(r)
for r in passwd_setted_repos:
unset_repo_passwd(r.id, self.email)
开发者ID:chuyskywalker,项目名称:seahub,代码行数:30,代码来源:accounts.py
示例2: _decorated
def _decorated(request, *args, **kwargs):
repo_id = kwargs.get('repo_id', None)
if not repo_id:
raise Exception, 'Repo id is not found in url.'
repo = get_repo(repo_id)
if not repo:
raise Http404
username = request.user.username
if repo.encrypted:
try:
server_crypto = UserOptions.objects.is_server_crypto(username)
except CryptoOptionNotSetError:
return render_to_response('options/set_user_options.html', {
}, context_instance=RequestContext(request))
if (repo.enc_version == 1 or (repo.enc_version == 2 and server_crypto)) \
and not is_passwd_set(repo_id, username):
return render_to_response('decrypt_repo_form.html', {
'repo': repo,
'next': request.get_full_path(),
}, context_instance=RequestContext(request))
if repo.enc_version == 2 and not server_crypto:
return render_error(request, _(u'Files in this library can not be viewed online.'))
return func(request, *args, **kwargs)
开发者ID:gekkstah,项目名称:seahub,代码行数:26,代码来源:decorators.py
示例3: _decorated
def _decorated(request, *args, **kwargs):
repo_id = kwargs.get('repo_id', None)
if not repo_id:
# TODO: raise error
pass
repo = get_repo(repo_id)
username = request.user.username
if repo.encrypted and not is_passwd_set(repo_id, username):
# Redirect uesr to decrypt repo page.
return render_to_response('decrypt_repo_form.html', {
'repo': repo,
'next': request.get_full_path(),
}, context_instance=RequestContext(request))
return func(request, *args, **kwargs)
开发者ID:beride,项目名称:seahub,代码行数:14,代码来源:decorators.py
示例4: _decorated
def _decorated(request, *args, **kwargs):
repo_id = kwargs.get('repo_id', None)
if not repo_id:
raise Exception, 'Repo id is not found in url.'
repo = get_repo(repo_id)
if not repo:
raise Http404
username = request.user.username
if repo.encrypted and not is_passwd_set(repo_id, username):
# Redirect uesr to decrypt repo page.
return render_to_response('decrypt_repo_form.html', {
'repo': repo,
'next': request.get_full_path(),
}, context_instance=RequestContext(request))
return func(request, *args, **kwargs)
开发者ID:bearstech,项目名称:seahub,代码行数:15,代码来源:decorators.py
示例5: remove_org_repo_passwds
def remove_org_repo_passwds(self, org_id):
"""
Remove all org repo decryption passwords stored on server.
"""
from seahub.utils import get_user_repos
owned_repos, shared_repos, groups_repos, public_repos = get_user_repos(self.email, org_id=org_id)
def has_repo(repos, repo):
for r in repos:
if repo.id == r.id:
return True
return False
passwd_setted_repos = []
for r in owned_repos + shared_repos + groups_repos + public_repos:
if not has_repo(passwd_setted_repos, r) and r.encrypted and \
is_passwd_set(r.id, self.email):
passwd_setted_repos.append(r)
for r in passwd_setted_repos:
unset_repo_passwd(r.id, self.email)
开发者ID:pinguo-liuhongwei,项目名称:seahub,代码行数:21,代码来源:accounts.py
示例6: _decorated
def _decorated(request, *args, **kwargs):
repo_id = kwargs.get("repo_id", None)
if not repo_id:
raise Exception, "Repo id is not found in url."
repo = get_repo(repo_id)
if not repo:
raise Http404
username = request.user.username
if repo.encrypted:
try:
server_crypto = UserOptions.objects.is_server_crypto(username)
except CryptoOptionNotSetError:
return render_to_response("options/set_user_options.html", {}, context_instance=RequestContext(request))
if (repo.enc_version == 1 or (repo.enc_version == 2 and server_crypto)) and not is_passwd_set(
repo_id, username
):
return render_to_response(
"decrypt_repo_form.html",
{"repo": repo, "next": request.get_full_path(), "force_server_crypto": FORCE_SERVER_CRYPTO},
context_instance=RequestContext(request),
)
if repo.enc_version == 2 and not server_crypto:
return render_error(request, _(u"Files in this library can not be viewed online."))
return func(request, *args, **kwargs)
开发者ID:rominf,项目名称:seahub,代码行数:27,代码来源:decorators.py
示例7: _decorated
def _decorated(request, *args, **kwargs):
repo_id = kwargs.get("repo_id", None)
if not repo_id:
raise Exception, "Repo id is not found in url."
repo = get_repo(repo_id)
if not repo:
raise Http404
username = request.user.username
if repo.encrypted:
if (repo.enc_version == 1 or (repo.enc_version == 2 and SERVER_CRYPTO)) and not is_passwd_set(
repo_id, username
):
# Redirect uesr to decrypt repo page.
return render_to_response(
"decrypt_repo_form.html",
{"repo": repo, "next": request.get_full_path()},
context_instance=RequestContext(request),
)
if repo.enc_version == 2 and not SERVER_CRYPTO:
return render_error(request, _(u"Files in this library can not be viewed online."))
return func(request, *args, **kwargs)
开发者ID:vIiRuS,项目名称:seahub,代码行数:23,代码来源:decorators.py
示例8: get
def get(self, request, format=None):
email = request.user.username
repos_json = []
owned_repos = list_personal_repos_by_owner(email)
calculate_repo_info(owned_repos, email)
owned_repos.sort(lambda x, y: cmp(y.latest_modify, x.latest_modify))
for r in owned_repos:
repo = {
"type":"repo",
"id":r.id,
"owner":email,
"name":r.name,
"desc":r.desc,
"mtime":r.latest_modify,
"root":r.root,
"size":r.size,
"encrypted":r.encrypted,
"permission": 'rw', # Always have read-write permission to owned repo
}
repos_json.append(repo)
shared_repos = seafile_api.get_share_in_repo_list(email, -1, -1)
for r in shared_repos:
commit = get_commits(r.repo_id, 0, 1)[0]
if not commit:
continue
r.latest_modify = commit.ctime
r.root = commit.root_id
r.size = server_repo_size(r.repo_id)
r.password_need = is_passwd_set(r.repo_id, email)
r.permission = check_permission(r.repo_id, email)
repo = {
"type":"srepo",
"id":r.repo_id,
"owner":r.user,
"name":r.repo_name,
"desc":r.repo_desc,
"mtime":r.latest_modify,
"root":r.root,
"size":r.size,
"encrypted":r.encrypted,
"permission": r.permission,
}
repos_json.append(repo)
groups = get_personal_groups_by_user(email)
for group in groups:
g_repos = get_group_repos(group.id, email)
calculate_repo_info (g_repos, email)
g_repos.sort(lambda x, y: cmp(y.latest_modify, x.latest_modify))
for r in g_repos:
repo = {
"type":"grepo",
"id":r.id,
"owner":group.group_name,
"name":r.name,
"desc":r.desc,
"mtime":r.latest_modify,
"root":r.root,
"size":r.size,
"encrypted":r.encrypted,
"permission": check_permission(r.id, email),
}
repos_json.append(repo)
return Response(repos_json)
开发者ID:viktorlindgren,项目名称:seahub,代码行数:67,代码来源:views.py
示例9: is_password_set
def is_password_set(self):
if self.repo.encrypted:
return is_passwd_set(self.repo.id, self.user.username)
return False
开发者ID:orymate,项目名称:seahub,代码行数:4,代码来源:repo.py
示例10: render_group_info
def render_group_info(request, group_id, form):
group_id_int = int(group_id) # Checkeb by URL Conf
# remove user notifications
UserNotification.objects.filter(to_user=request.user.username,
msg_type='group_msg',
detail=str(group_id)).delete()
group = get_group(group_id_int)
if not group:
return HttpResponseRedirect(reverse('group_list', args=[]))
# Get all group members.
members = get_group_members(group_id_int)
# Check whether user belongs to the group.
joined = is_group_user(group_id_int, request.user.username)
if not joined and not request.user.is_staff:
# Return group public info page.
return render_to_response('group/group_pubinfo.html', {
'members': members,
'group': group,
}, context_instance=RequestContext(request))
is_staff = True if check_group_staff(group.id, request.user) else False
managers = []
common_members = []
for member in members:
if member.is_staff == 1:
managers.append(member)
else:
common_members.append(member)
org = request.user.org
if org:
repos = get_org_group_repos(org['org_id'], group_id_int,
request.user.username)
else:
repos = get_group_repos(group_id_int, request.user.username)
recent_commits = []
cmt_repo_dict = {}
for repo in repos:
repo.user_perm = check_permission(repo.props.id, request.user.username)
cmmts = get_commits(repo.props.id, 0, 10)
for c in cmmts:
cmt_repo_dict[c.id] = repo
recent_commits += cmmts
recent_commits.sort(lambda x, y : cmp(y.props.ctime, x.props.ctime))
recent_commits = recent_commits[:15]
for cmt in recent_commits:
cmt.repo = cmt_repo_dict[cmt.id]
cmt.repo.password_set = is_passwd_set(cmt.props.repo_id,
request.user.username)
cmt.tp = cmt.props.desc.split(' ')[0]
"""group messages"""
# Make sure page request is an int. If not, deliver first page.
try:
current_page = int(request.GET.get('page', '1'))
per_page= int(request.GET.get('per_page', '15'))
except ValueError:
current_page = 1
per_page = 15
msgs_plus_one = GroupMessage.objects.filter(
group_id=group_id).order_by(
'-timestamp')[per_page*(current_page-1) : per_page*current_page+1]
if len(msgs_plus_one) == per_page + 1:
page_next = True
else:
page_next = False
group_msgs = msgs_plus_one[:per_page]
attachments = MessageAttachment.objects.filter(group_message__in=group_msgs)
msg_replies = MessageReply.objects.filter(reply_to__in=group_msgs)
reply_to_list = [ r.reply_to_id for r in msg_replies ]
for msg in group_msgs:
msg.reply_cnt = reply_to_list.count(msg.id)
for att in attachments:
if msg.id == att.group_message_id:
# Attachment name is file name or directory name.
# If is top directory, use repo name instead.
path = att.path
if path == '/':
repo = get_repo(att.repo_id)
if not repo:
# TODO: what should we do here, tell user the repo
# is no longer exists?
continue
att.name = repo.name
else:
# cut out last '/'
if path[-1] == '/':
#.........这里部分代码省略.........
开发者ID:cjeanneret,项目名称:seahub,代码行数:101,代码来源:views.py
示例11: render_group_info
def render_group_info(request, group_id, form):
group_id_int = int(group_id) # Checkeb by URL Conf
# remove user notifications
UserNotification.objects.filter(to_user=request.user.username,
msg_type='group_msg',
detail=str(group_id)).delete()
group = get_group(group_id_int)
if not group:
return HttpResponseRedirect(reverse('group_list', args=[]))
# Get all group members.
members = get_group_members(group_id_int)
# Check whether user belongs to the group.
joined = is_group_user(group_id_int, request.user.username)
if not joined and not request.user.is_staff:
# Return group public info page.
return render_to_response('group/group_pubinfo.html', {
'members': members,
'group': group,
}, context_instance=RequestContext(request))
is_staff = True if check_group_staff(group.id, request.user) else False
org = request.user.org
if org:
repos = get_org_group_repos(org['org_id'], group_id_int,
request.user.username)
else:
repos = get_group_repos(group_id_int, request.user.username)
recent_commits = []
cmt_repo_dict = {}
for repo in repos:
repo.user_perm = check_permission(repo.props.id, request.user.username)
cmmts = get_commits(repo.props.id, 0, 10)
for c in cmmts:
cmt_repo_dict[c.id] = repo
recent_commits += cmmts
recent_commits.sort(lambda x, y : cmp(y.props.ctime, x.props.ctime))
recent_commits = recent_commits[:15]
for cmt in recent_commits:
cmt.repo = cmt_repo_dict[cmt.id]
cmt.repo.password_set = is_passwd_set(cmt.props.repo_id,
request.user.username)
cmt.tp = cmt.props.desc.split(' ')[0]
return render_to_response("group/group_info.html", {
"members": members,
"repos": repos,
"recent_commits": recent_commits,
"group_id": group_id,
"group" : group,
"is_staff": is_staff,
"is_join": joined,
"form": form,
'create_shared_repo': True,
'group_members_default_display': GROUP_MEMBERS_DEFAULT_DISPLAY,
}, context_instance=RequestContext(request));
开发者ID:beride,项目名称:seahub,代码行数:64,代码来源:views.py
注:本文中的seaserv.is_passwd_set函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论