Exemple #1
0
class Plan_setter( object ):
  """
  Set the rate plan for a particular user.
  """
  def __init__( self, database, settings, user_id, rate_plan ):
    self.database = database
    self.user_id = user_id
    self.rate_plan = int( rate_plan )

    rate_plans = settings[ u"global" ][ u"luminotes.rate_plans" ]
    self.users = Users( database, None, None, None, None, rate_plans, [] )

    self.set_plan()
    self.database.commit()

  def set_plan( self ):
    user = self.database.load( User, self.user_id )

    if not user:
      print "user id %s unknown" % self.user_id
      sys.exit( 1 )

    user.rate_plan = self.rate_plan
    self.database.save( user, commit = False )

    # update a user's group membership as a result of a rate plan change
    self.users.update_groups( user )
Exemple #2
0
  def __init__( self, database, settings, user_id, rate_plan ):
    self.database = database
    self.user_id = user_id
    self.rate_plan = int( rate_plan )

    rate_plans = settings[ u"global" ][ u"luminotes.rate_plans" ]
    self.users = Users( database, None, None, None, None, rate_plans, [] )

    self.set_plan()
    self.database.commit()
Exemple #3
0
  def create_desktop_user( self ):
    from controller.Users import Users
    users = Users(
      self.database,
      self.settings[ u"luminotes.http_url"]  ,
      self.settings[ u"luminotes.https_url"]  ,
      self.settings[ u"luminotes.support_email"]  ,
      self.settings[ u"luminotes.payment_email"]  ,
      self.settings[ u"luminotes.rate_plans"] ,
      self.settings[ u"luminotes.download_products"] ,
    )

    users.create_user( u"desktopuser" )
Exemple #4
0
    def create_desktop_user(self):
        from controller.Users import Users
        users = Users(
            self.database,
            self.settings[u"luminotes.http_url"],
            self.settings[u"luminotes.https_url"],
            self.settings[u"luminotes.support_email"],
            self.settings[u"luminotes.payment_email"],
            self.settings[u"luminotes.rate_plans"],
            self.settings[u"luminotes.download_products"],
        )

        users.create_user(u"desktopuser")
  def load_original_blog_notebook( self ):
    anonymous = self.database.select_one( User, User.sql_load_by_username( u"anonymous" ) )

    from controller.Users import Users
    users = Users(
      self.database,
      self.settings[ u"global" ].get( u"luminotes.http_url", u"" ),
      self.settings[ u"global" ].get( u"luminotes.https_url", u"" ),
      self.settings[ u"global" ].get( u"luminotes.support_email", u"" ),
      self.settings[ u"global" ].get( u"luminotes.payment_email", u"" ),
      self.settings[ u"global" ].get( u"luminotes.rate_plans", [] ),
      self.settings[ u"global" ].get( u"luminotes.download_products", [] ),
    )

    result = users.current( anonymous.object_id ) 
    blog_notebooks = [ nb for nb in result[ "notebooks" ] if nb.name == u"Luminotes blog" ]

    return blog_notebooks[ 0 ]
Exemple #6
0
    def load_original_blog_notebook(self):
        anonymous = self.database.select_one(
            User, User.sql_load_by_username(u"anonymous"))

        from controller.Users import Users
        users = Users(
            self.database,
            self.settings[u"global"].get(u"luminotes.http_url", u""),
            self.settings[u"global"].get(u"luminotes.https_url", u""),
            self.settings[u"global"].get(u"luminotes.support_email", u""),
            self.settings[u"global"].get(u"luminotes.payment_email", u""),
            self.settings[u"global"].get(u"luminotes.rate_plans", []),
            self.settings[u"global"].get(u"luminotes.download_products", []),
        )

        result = users.current(anonymous.object_id)
        blog_notebooks = [
            nb for nb in result["notebooks"] if nb.name == u"Luminotes blog"
        ]

        return blog_notebooks[0]
from controller.Receipt import Receipt
from controller.Users import Users
from controller.SalesTrx import SalesTrx
from util.SerializerMiddleware import SerializerMiddleware


api = application = falcon.API(middleware=[SerializerMiddleware(),])
t = testview()
a = AccessRights()
purchase_trx =PurchaseTrx()
common_lookups =CommonLookups()
supplier_master = SupplierMaster()
customer_master = CustomerMaster()
inventory_items = InventoryItems()
receipt = Receipt()
users = Users()
sales_trx = SalesTrx()
api.add_route('/api/test', t)
api.add_route('/api/access-right', a)
api.add_route('/api/purchase_trx', purchase_trx)
api.add_route('/api/sales_trx', sales_trx)
api.add_route('/api/common_lookups', common_lookups)
api.add_route('/api/supplier_master', supplier_master)
api.add_route('/api/inventory_items', inventory_items)
api.add_route('/api/customer_master', customer_master)
api.add_route('/api/receipt', receipt)

api.add_route('/api/users',users)