Ejemplo n.º 1
0
 def run(self):
     banner("Install Cloudmesh Management")
     obj = Mongo()
     obj.check_mongo()
     get_mongo_db("manage", DBConnFactory.TYPE_MONGOENGINE)
     install.run(self)
     banner("Adding Super User")
     users = Users()
     found = User.objects(username='super')
     if not found:
         data = User(
             status="approved",
             title="None",
             firstname="Super",
             lastname="User",
             email="[email protected]",
             username="super",
             active=True,
             password=sha256_crypt.encrypt("MyPassword"),
             phone="555-555-5555",
             department="IT",
             institution="IU",
             institutionrole="Other",
             address="IU",
             country="United States(US)",
             citizenship="United States(US)",
             bio="Manage Project Committee",
             url="http://cloudmesh.github.io/cloudmesh.html",
             advisor="None",
             confirm=sha256_crypt.encrypt("MyPassword"),
             projects=[],
         )
         users.add(data)
 def setup(self):
     # HEADING()
     db_name = get_mongo_dbname_from_collection("manage")
     if db_name:
         meta = {'db_alias': db_name}
     obj = Mongo()
     obj.check_mongo()
     get_mongo_db("manage", DBConnFactory.TYPE_MONGOENGINE)
     pass
Ejemplo n.º 3
0
def get_current_user_role():
    filename = path_expand("~/.cloudmesh/{0}/{1}".format("accounts", ".config"))
    with open(filename, 'r') as yamlfile:
        cfg = yaml.load(yamlfile)
        username = cfg['user']
    db_name = get_mongo_dbname_from_collection("manage")
    if db_name:
        meta = {'db_alias': db_name}
    ##
    ##
    obj = Mongo()
    obj.check_mongo()
    ##
    ##
    get_mongo_db("manage", DBConnFactory.TYPE_MONGOENGINE)
    found = User.objects(username=username).only('roles').first()
    return found.roles
    pass
Ejemplo n.º 4
0
 def __init__(self):
     obj = Mongo()
     obj.check_mongo()
     get_mongo_db("manage", DBConnFactory.TYPE_MONGOENGINE)
Ejemplo n.º 5
0
from cloudmesh_database.dbconn import get_mongo_db, DBConnFactory
from cloudmesh_management.project import Projects
from cloudmesh_management.user import Users
from cloudmesh_management.base_user import User
from cloudmesh_management.base_project import Project
from cmd3.console import Console
from faker import Factory
from pprint import pprint
from passlib.hash import sha256_crypt
import uuid
from cloudmesh_base.util import banner
from cloudmesh_management.mongo import Mongo


obj = Mongo()
obj.check_mongo()
get_mongo_db("manage", DBConnFactory.TYPE_MONGOENGINE)

# --------------------------------------------
# The generate class generates 10 random users
# --------------------------------------------

users = Users()
projects = Projects()

# http://www.joke2k.net/faker

fake = Factory.create()


def random_user():
Ejemplo n.º 6
0
 def __init__(self):
     obj = Mongo()
     obj.check_mongo()
     get_mongo_db("manage", DBConnFactory.TYPE_MONGOENGINE)
     self.projects = Project.objects()
     self.users = User.objects()