Skip to content

Instantly share code, notes, and snippets.

@mrkurt
mrkurt / gist:2303
Created July 24, 2008 21:19
A mixin for creating secured proxy objects based on permission levels
module Securable
def self.included(base)
base.extend(ClassMethods)
end
class Secured
def initialize(p, o)
@o = o
@o.class.methods_with_permissions(p) {|m| define_proxy_method(m)}
end
public class Test{
[Serializable]
[Securable]
[ThisPropertyIsAwesome]
public string Name{get; set;}
}
class User < Model
include CouchObject::Persistable
include Securable
with_attr_reader :username do
min_read_permission :guest
end
with_attr_reader :email, :password do
min_read_permission :owner
class Class
def with_attr_reader(*args, &b)
with_attr(:attr_reader, *args, &b)
end
def with_attr_writer(*args, &b)
with_attr(:attr_writer, *args, &b)
end
def with_attr_accessor(*args, &b)
 digg.com
 yahoo.com
 news.google.com
 google.com
 reddit.com
 episteme.arstechnica.com
 slashdot.org
 stumbleupon.com
 daringfireball.net
 macsurfer.com
#!/usr/bin/perl -w
use strict;
use lib 'extlib', 'lib', '../lib';
my %opts;
use Getopt::Long;
GetOptions("type=s", \my($type),
"id=i", \my($id),
"cols=s", \my($cols),
#!/usr/bin/perl -w
use strict;
use lib 'extlib', 'lib', '../lib';
my %opts;
use Getopt::Long;
GetOptions("type=s", \my($type),
"id=i", \my($id),
"cols=s", \my($cols),
[Wed Oct 22 14:53:51 2008] [error] [client 72.213.170.139] mod_wsgi (pid=342): Exception occurred processing WSGI script '/home/teamcity/staging/ars-djang o-project/apache/staging.wsgi'.
[Wed Oct 22 14:53:51 2008] [error] [client 72.213.170.139] Traceback (most recent call last):
[Wed Oct 22 14:53:51 2008] [error] [client 72.213.170.139] File "/usr/lib/python2.5/site-packages/django/core/handlers/wsgi.py", line 239, in __call__
[Wed Oct 22 14:53:51 2008] [error] [client 72.213.170.139] response = self.get_response(request)
[Wed Oct 22 14:53:51 2008] [error] [client 72.213.170.139] File "/usr/lib/python2.5/site-packages/django/core/handlers/base.py", line 128, in get_respon se
[Wed Oct 22 14:53:51 2008] [error] [client 72.213.170.139] return self.handle_uncaught_exception(request, resolver, exc_info)
[Wed Oct 22 14:53:51 2008] [error] [client 72.213.170.139] File "/usr/lib/python2.5/site-packages
from setuptools import setup
setup(name='twittersmash',
version='0.1',
description='Ars Technica\'s twitter publishing application',
author='Clint Ecker, Kurt Mackey',
author_email='clint@arstechnica.com',
url='https://github.com/ArsTechnica/twittersmash/tree/master',
packages=['twittersmash',],
entry_points={'django.apps': 'twittersmash = twittersmash'},
internal string EncodePassword(string pass, int passwordFormat, string salt)
{
if (passwordFormat == 0)
{
return pass;
}
byte[] bytes = Encoding.Unicode.GetBytes(pass);
byte[] src = Convert.FromBase64String(salt);
byte[] dst = new byte[src.Length + bytes.Length];
byte[] inArray = null;