日々のメモ書き
Debian Developerが綴るメモ
Collective SVN report
2007-06-17
- r43428 quills.remoteblogging
- r43446 genesis model refactoring, renamed Mapping to Security
- r43159 ATAmazon for-plone-3-0
- genesisが進行中
- r43653 grouparchy First implementation of group based architecture
- r43900 SmartPrintNG - based on XSL-FO
- r43913 Quills Change to using interfaces from quills.core.
Plone SVN report
2007-06-17
- r15262 Define the new contentviews viewlet manager, and associated viewlets; also define footer and colophon viewlets.
- r15305 Made LinguaPlone aware, now it returns all translations.
- r15314 plone.app.viewletmanager merge #6649 tree
- r15354 plone.memoize - Use a md5 hash of the provided key in RAMCacheAdapter, reducing the memory footprint and speeding up lookup time.
lenny リリース予定日
Early September 2008
debian-devel-announceによると。結構のんびりしている気がするけど。こんなもんだっけ?
大学祭
相変わらず家の近所なのでのぞくだけはのぞく。
年々規模が小さくなっている。少子化の影響でしょうか。学生の下らない活動への意欲が落ちているのか。
Plone SmoothGalleryとprivate
Plone Smooth Galleryの写真をprivateにしたいが。
publishedじゃないと表示されない。publishedにすると、親フォルダがprivateでも見える。まいったまいった。前にフォルダならなんとかする方法があったのを覚えているが、色々やらなきゃいけないとなると面倒で仕方がないぞ。
Tasty Bookmarks
Tasty Bookmarksをインストール。
昔はATBookmarksと言っていました。Social Bookmarkの機能もあります。導入したのはリンクを張るときにURLのコピー&ペーストでやるのが面倒なのが理由です。
djangoでLDAP認証
djangoでLDAP認証する方法
Django's new authentication backends という記事もあるのだが、これではanonymousでできないのでちょっと改良。anonymousでbindしてdnを捜して、そのdnで認証するという手順。手順は普通の話。
import ldap
import ldap
from django.contrib.auth.models import User
# Constants
AUTH_LDAP_SERVER = '192.168.0.1'
class LDAPBackend:
def authenticate(self, username=None, password=None):
base = "ou=Users,dc=example,dc=jp"
scope = ldap.SCOPE_SUBTREE
filter = "(&(objectclass=person) (uid=%s))" % username
ret = ['dn']
# Authenticate the base user so we can search
try:
l = ldap.open(AUTH_LDAP_SERVER)
l.protocol_version = ldap.VERSION3
except ldap.LDAPError:
return None
try:
result_id = l.search(base, scope, filter, ret)
result_type, result_data = l.result(result_id, 0)
# print result_data
if (len(result_data) != 1):
return None
# Attempt to bind to the user's DN
l.simple_bind_s(result_data[0][0],password)
try:
user = User.objects.get(username__exact=username)
except:
# Theoretical backdoor could be input right here. We don't
# want that, so input an unused random password here.
# The reason this is a backdoor is because we create a
# User object for LDAP users so we can get permissions,
# however we -don't- want them able to login without
# going through LDAP with this user. So we effectively
# disable their non-LDAP login ability by setting it to a
# random password that is not given to them. In this way,
# static users that don't go through ldap can still login
# properly, and LDAP users still have a User object.
from random import choice
import string
temp_pass = ""
for i in range(8):
temp_pass = temp_pass + choice(string.letters)
user = User.objects.create_user(username,
username + '@example.jp',temp_pass)
user.is_staff = False
user.save()
# Success.
return user
except ldap.INVALID_CREDENTIALS:
# Name or password were bad. Fail.
return None
def get_user(self, user_id):
try:
return User.objects.get(pk=user_id)
except User.DoesNotExist:
return None
ほんのちょっとだけ変更してあります。
Plone SVN report
2007-06-09
- r15157 plone.app.cache Make new plone.app.cache package for configuration of zope.app.cache RAMCaches.
- r15159 portletをRAMCacheを利用するようにする
- r15190 tabをfolder以外も表示するように変更
Collective SVN report
2007-06-09
- r43088 Quills - Remove ClassSecurityInfo stuff. It doesn't work now, and when security is fixed, it'll be done with ZCML allowed_interface declarations.
- r43103 roulationpolicy - item を folderに追加する場所を操作するらしい。
- r43232 plonegears
- r43332 genesis - MDAだったけ?
ismaster
A graphical CD image editor
ファイルの追加とかできるので便利。