| 4692 |
mandeep.dh |
1 |
'''
|
| 4754 |
mandeep.dh |
2 |
Created on 21-Mar-2012
|
| 4692 |
mandeep.dh |
3 |
|
| 4754 |
mandeep.dh |
4 |
@author: Mandeep Dhir
|
| 4692 |
mandeep.dh |
5 |
'''
|
|
|
6 |
|
|
|
7 |
from elixir.entity import Entity
|
|
|
8 |
from elixir.fields import Field
|
|
|
9 |
from sqlalchemy.types import String, Integer, Boolean
|
|
|
10 |
from elixir.options import using_options, using_table_options
|
|
|
11 |
|
|
|
12 |
from shop2020.thriftpy.utils.ttypes import Agent as TAgent
|
|
|
13 |
|
|
|
14 |
class Agent(Entity):
|
|
|
15 |
id = Field(Integer, primary_key=True)
|
|
|
16 |
name = Field(String(128))
|
|
|
17 |
password = Field(String(128))
|
|
|
18 |
emailId = Field(String(32))
|
|
|
19 |
managerId = Field(Integer)
|
|
|
20 |
isActive = Field(Boolean)
|
|
|
21 |
using_options(shortnames=True)
|
|
|
22 |
using_table_options(mysql_engine="InnoDB")
|
|
|
23 |
|
|
|
24 |
def to_thrift_object(self):
|
|
|
25 |
'''
|
|
|
26 |
Returns the thrift object corresponding to this agent object.
|
|
|
27 |
'''
|
|
|
28 |
t_agent_user = TAgent()
|
|
|
29 |
t_agent_user.id = self.id
|
|
|
30 |
t_agent_user.name = self.name
|
|
|
31 |
t_agent_user.password = self.password
|
|
|
32 |
t_agent_user.emailId = self.emailId
|
|
|
33 |
t_agent_user.managerId = self.managerId
|
|
|
34 |
t_agent_user.isActive = self.isActive
|
|
|
35 |
return t_agent_user
|
| 4754 |
mandeep.dh |
36 |
|
|
|
37 |
class User_Roles(Entity):
|
|
|
38 |
agentId = Field(Integer, primary_key=True)
|
| 4771 |
mandeep.dh |
39 |
role_name = Field(String(128), primary_key=True)
|
| 4754 |
mandeep.dh |
40 |
using_options(shortnames=True)
|
|
|
41 |
using_table_options(mysql_engine="InnoDB")
|
|
|
42 |
|
|
|
43 |
class Roles_Permissions(Entity):
|
|
|
44 |
role_name = Field(Integer, primary_key=True)
|
| 4771 |
mandeep.dh |
45 |
permission = Field(String(128), primary_key=True)
|
| 4754 |
mandeep.dh |
46 |
using_options(shortnames=True)
|
|
|
47 |
using_table_options(mysql_engine="InnoDB")
|