Committer: afedorov
LJSUP-5065: Develop OAuth API authorization server/scheme
U branches/oauth/bin/upgrading/en_LJ.dat
U branches/oauth/bin/upgrading/update-db-local.pl
Modified: branches/oauth/bin/upgrading/en_LJ.dat
===================================================================
--- branches/oauth/bin/upgrading/en_LJ.dat 2010-01-19 08:22:36 UTC (rev 8116)
+++ branches/oauth/bin/upgrading/en_LJ.dat 2010-01-19 08:45:40 UTC (rev 8117)
@@ -3935,6 +3935,46 @@
settings.security.visibility.nobody=Nobody
+setting.userapps.access=Access Type
+
+setting.userapps.access.A=Allow
+
+setting.userapps.access.R=Reject
+
+setting.userapps.access.T=Only tester or owner
+
+setting.userapps.add.label=Add New Application
+
+setting.userapps.consumer_key=Consumer Key
+
+setting.userapps.consumer_secret=Consumer Secret
+
+setting.userapps.description=Description
+
+setting.userapps.edit=Edit Application
+
+setting.userapps.error.null_name=Null name
+
+setting.userapps.name=Name
+
+setting.userapps.status=Status
+
+setting.userapps.status.A=Approved
+
+setting.userapps.status.C=Checking
+
+setting.userapps.status.S=Suspended
+
+setting.userapps.type=Type
+
+setting.userapps.type.R=Read Only
+
+setting.userapps.type.W=Read/Write
+
+setting.userapps.list.label=Your Applications
+
+setting.userapps.nolist=Empty
+
settings.usermessaging.opt.F=Friends Only
settings.usermessaging.question=Receive messages from:
Modified: branches/oauth/bin/upgrading/update-db-local.pl
===================================================================
--- branches/oauth/bin/upgrading/update-db-local.pl 2010-01-19 08:22:36 UTC (rev 8116)
+++ branches/oauth/bin/upgrading/update-db-local.pl 2010-01-19 08:45:40 UTC (rev 8117)
@@ -1389,6 +1389,82 @@
) TYPE=InnoDB
EOC
+# Store user applications
+register_tablecreate("userapps", <<'EOC');
+CREATE TABLE userapps (
+ consumer_key varchar(16) not null,
+ consumer_secret varchar(28) not null,
+ access char(1) not null default 'T', # Access user to application: R - reject, A - allow, T - only tester or owner
+ type char(1) not null default 'R', # Access application to user: R - read only, W - read/write
+ status char(1) not null default 'C', # Current application status: C - checking, A - approved, S - suspended
+ popularity_count int unsigned not null default 0,
+ userid int unsigned not null,
+ callback_url varchar(255),
+ name varchar(255) not null,
+ image varchar(255) not null,
+ brief varchar(90) not null default '',
+ tags varchar(255) not null default '',
+ description text not null default '',
+ requirements text,
+
+ PRIMARY KEY (consumer_key),
+ INDEX(userid),
+ INDEX(popularity_count)
+) TYPE=InnoDB
+EOC
+
+# Rules for access of application to the user's profile
+register_tablecreate("userapps_access", <<'EOC');
+CREATE TABLE userapps_access (
+ userid int(10) unsigned not null,
+ consumer_key varchar(16) not null,
+ access_mask smallint unsigned not null,
+
+ PRIMARY KEY (userid, consumer_key)
+) TYPE=InnoDB
+EOC
+
+# Store OAuth nonces for tokens.
+# One token must be valid only one request.
+register_tablecreate("oauth_nonces", <<'EOC');
+CREATE TABLE oauth_nonces (
+ nonce varchar(32) not null,
+ consumer_key varchar(16) not null,
+ timestamp int(10) not null,
+
+ PRIMARY KEY (nonce),
+ INDEX(timestamp)
+) TYPE=InnoDB
+EOC
+
+# Store OAuth request tokens
+register_tablecreate("oauth_request_tokens", <<'EOC');
+CREATE TABLE oauth_request_tokens (
+ token_key varchar(16) not null,
+ token_secret varchar(28) not null,
+ consumer_key varchar(16) not null,
+ userid int unsigned,
+ authorized enum('0', '1') not null default '0',
+ exchanged enum('0', '1') not null default '0',
+ timestamp int(10) not null,
+
+ PRIMARY KEY (token_key)
+) TYPE=InnoDB
+EOC
+
+# Store OAuth access tokens
+register_tablecreate("oauth_access_tokens", <<'EOC');
+CREATE TABLE oauth_access_tokens (
+ token_key varchar(16) not null,
+ token_secret varchar(28) not null,
+ consumer_key varchar(16) not null,
+ userid int unsigned not null,
+ timestamp int(10) not null,
+
+ PRIMARY KEY (token_key)
+) TYPE=InnoDB
+EOC
+
# *************************************************************
register_alter(sub {