Commit 180a79db authored by Ryan Herbert's avatar Ryan Herbert Committed by Mikaël Salson

remove unused code

parent 593cb188
......@@ -95,106 +95,7 @@ class SampleSetList():
orderby = ~db[type].id
)
step = len(query_gss) if step is None else step
auth.load_permissions(PermissionEnum.admin.value, type)
auth.load_permissions(PermissionEnum.anon.value, type)
self.elements = {}
for row in query_gss:
if (tags is not None and len(tags) > 0):
key = row[type]
else:
key = row
self.elements[key.id] = key
self.elements[key.id].file_count = 0
self.elements[key.id].size = 0
self.elements[key.id].conf_list = []
self.elements[key.id].conf_id_list = [-1]
self.elements[key.id].most_used_conf = ""
self.elements[key.id].groups = ""
self.elements[key.id].group_list = []
#self.elements[key.id].has_permission = auth.can_modify_sample_set(key.sample_set_id)
self.elements[key.id].has_permission = auth.can_modify_subset(type, key.id)
self.elements[key.id].anon_allowed = auth.can_view_info(type, key.id)
self.element_ids = self.elements.keys()
def load_creator_names(self):
query_creator = db(
(db[self.type].creator == db.auth_user.id)
& (db[self.type].id.belongs(self.element_ids))
).select(
db[self.type].id, db.auth_user.last_name
)
for i, row in enumerate(query_creator) :
self.elements[row[self.type].id].creator = row.auth_user.last_name
def load_sample_information(self):
query_sample = db(
(db.sample_set_membership.sample_set_id == db[self.type].sample_set_id)
&(db.sequence_file.id == db.sample_set_membership.sequence_file_id)
&(db[self.type].id.belongs(self.element_ids))
).select(
db[self.type].id, db.sequence_file.size_file
)
for i, row in enumerate(query_sample) :
self.elements[row[self.type].id].file_count += 1
self.elements[row[self.type].id].size += row.sequence_file.size_file
def load_config_information(self):
query = db(
(db[self.type].sample_set_id == db.fused_file.sample_set_id) &
(db.fused_file.config_id == db.config.id) &
(auth.vidjil_accessible_query(PermissionEnum.read_config.value, db.config) |
auth.vidjil_accessible_query(PermissionEnum.admin_config.value, db.config) ) &
(db[self.type].id.belongs(self.element_ids))
).select(
db[self.type].id, db.config.name, db.config.id, db.fused_file.fused_file
)
for i, row in enumerate(query) :
self.elements[row[self.type].id].conf_list.append(
{'id': row.config.id, 'name': row.config.name, 'fused_file': row.fused_file.fused_file})
self.elements[row[self.type].id].conf_id_list.append(row.config.id)
for key, row in self.elements.iteritems():
row.most_used_conf = max(set(row.conf_id_list), key=row.conf_id_list.count)
row.confs = ", ".join(list(set(map(lambda elem: elem['name'], row.conf_list))))
def load_permitted_groups(self):
query = db(
((db[self.type].id == db.auth_permission.record_id) | (db.auth_permission.record_id == 0)) &
(db.auth_permission.table_name == self.type) &
(db.auth_permission.name == PermissionEnum.access.value) &
(db.auth_group.id == db.auth_permission.group_id)
& (db[self.type].id.belongs(self.element_ids))
).select(
db[self.type].id, db.auth_group.role, db.auth_group.id
)
for i, row in enumerate(query) :
self.elements[row[self.type].id].group_list.append(row.auth_group.role.replace('user_','u'))
for key, row in self.elements.iteritems():
row.groups = ", ".join(filter(lambda g: g != 'admin', set(row.group_list)))
def load_anon_permissions(self):
query = db(
(db.auth_permission.name == "anon") &
(db.auth_permission.table_name == self.type) &
(db[self.type].id == db.auth_permission.record_id ) &
(db.auth_group.id == db.auth_permission.group_id ) &
(db.auth_membership.user_id == auth.user_id) &
(db.auth_membership.group_id == db.auth_group.id) &
(db[self.type].id.belongs(self.element_ids))
).select(
db[self.type].id
)
for i, row in enumerate(query) :
self.elements[row.id].anon_allowed = True
def get_values(self):
return self.elements.values()
self.result = query_gss
def __len__(self):
return len(self.element_ids)
......
Markdown is supported
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