Savarese Software Research Corporation
login/types.h
Go to the documentation of this file.
00001 /*
00002  * Copyright 2006-2009 Savarese Software Research Corporation
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *     https://www.savarese.com/software/ApacheLicense-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00022 #ifndef __SSRC_WSPR_LOGIN_TYPES_H
00023 #define __SSRC_WSPR_LOGIN_TYPES_H
00024 
00025 #include <ssrc/wispers/types.h>
00026 #include <ssrc/wispers/database/types.h>
00027 
00028 #include <set>
00029 #include <map>
00030 
00031 __BEGIN_NS_SSRC_WSPR_LOGIN
00032 
00033 WSPR_DB_ROW_WITH_KEY(User,
00034                     ((uid_type, uid))
00035                     ((string, login))
00036                     ((string, login_lcase))
00037                     ((string, password))
00038                     ((sec_type, created))
00039                     ((sec_type, last_login))
00040                     ((sec_type, last_logout)), (0))
00041 
00042 WSPR_DB_ROW_WITH_KEY(PublicUser,
00043                     ((uid_type, uid))
00044                     ((string, login))
00045                     ((sec_type, created))
00046                     ((sec_type, last_login))
00047                     ((sec_type, last_logout)), (0))
00048 
00049 WSPR_DB_ROW_WITH_KEY(Group, ((gid_type, gid))((string, group)), (0))
00050 
00051 WISP_STRUCT(LoginStatus, ((string, login))((bool, is_logged_in)));
00052 
00053 typedef std::set<uid_type> uid_set;
00054 typedef std::map<uid_type, LoginStatus> uid_login_map;
00055 
00056 __END_NS_SSRC_WSPR_LOGIN
00057 
00058 __BEGIN_NS_SSRC_WSPR_DATABASE
00059 
00060 // Define conversion for use by FindLoginForUID.  Place here instead of
00061 // service.cc to make available to unit tests.
00062 template<> inline
00063 NS_SSRC_WSPR_LOGIN::uid_login_map::value_type
00064 values<NS_SSRC_WSPR_LOGIN::uid_login_map::value_type>(const ResultSet &
00065                                                       result_set)
00066 {
00067   using NS_SSRC_WSPR_LOGIN::uid_login_map;
00068   return
00069     uid_login_map::value_type(result_set.value<uid_login_map::key_type>(0),
00070                         uid_login_map::mapped_type(result_set.value<string>(1),
00071                                                    result_set.value<bool>(2)));
00072 }
00073 
00074 __END_NS_SSRC_WSPR_DATABASE
00075 
00076 #endif

Savarese Software Research Corporation
Copyright © 2006-2011 Savarese Software Research Corporation. All rights reserved.