Commit dec58f3b authored by Celine Noirot's avatar Celine Noirot
Browse files

Add function which retrieve ids of users

Add static method to get project from a run_id
parent 91a2a492
......@@ -130,6 +130,20 @@ class Project(object):
config.write(open(config_path,'w'))
return config_path
def is_admin(self, admin_login):
"""
Return true/false
@param admin_user: login of the user
@return : true is admin_login is in admin user of the project
"""
t3mysql = t3MySQLdb()
user_ids = t3mysql.get_users(self.id,"administrator")
my_user_id = t3mysql.get_user_id(admin_login)
if my_user_id in user_ids :
return True
else :
return False
@staticmethod
def get_from_id (id):
"""
......@@ -142,3 +156,16 @@ class Project(object):
return Project(name, description, None, id)
except :
return None
@staticmethod
def get_from_run_id (id):
"""
Return a project object specified by run id
@param id : the run id
"""
try:
t3mysql = t3MySQLdb()
id = t3mysql.select_project_id_from_run_id(id)
return Project.get_from_id(id)
except :
return None
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment