Created
May 28, 2012 08:38
-
-
Save thejhh/2818014 to your computer and use it in GitHub Desktop.
Example source code for a command 'account' in Sendanor's CCD Server
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* $Id: account.js 13872 2010-08-23 11:42:51Z jheusala $ */ | |
| command.help.addSVN({ | |
| url:"$URL: https://svn.sendanor.fi/svn/sendanor/projects/ccd/server/trunk/commands/account.js $", | |
| author:"$Author: jheusala $", | |
| revision:"$Revision: 13872 $", | |
| date:"$Date: 2010-08-23 14:42:51 +0300 (Mon, 23 Aug 2010) $", | |
| id:"$Id: account.js 13872 2010-08-23 11:42:51Z jheusala $" | |
| }); | |
| command.help.description = "This command will output account records for current account."; | |
| command.add( | |
| UseModule('CheckUserHasLoggedIn'), | |
| function(ccd) { | |
| var account_id = ccd.session.account.account_id; | |
| var db = generic_db("sendanor"); | |
| var table = db.table("account"); | |
| var account = table.get(account_id); | |
| if(!account) throw Error("No account record"); | |
| var record = Normalize.record(account) || {}; | |
| delete record.password; | |
| delete record.validation_code; | |
| ccd.reply.add(CCD_Record.build({name:"account",value:record})); | |
| }); | |
| /* EOF */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment