예제 #1
0
파일: remote_info.py 프로젝트: GLab/ToMaTo
	def create(name, label, attrs=None):
		if attrs is None: attrs = {}
		attrs['label'] = label
		res = get_backend_users_proxy().organization_create(name, **attrs)
		get_organization_info(name).invalidate_info()
		get_organization_list.invalidate()
		return res
예제 #2
0
def get_organization_list():
    """
	get the list of organizations
	:return: list of organizations
	:rtype: list(dict)
	"""
    return get_backend_users_proxy().organization_list()
예제 #3
0
 def create(name, label, attrs=None):
     if attrs is None: attrs = {}
     attrs['label'] = label
     res = get_backend_users_proxy().organization_create(name, **attrs)
     get_organization_info(name).invalidate_info()
     get_organization_list.invalidate()
     return res
예제 #4
0
파일: remote_info.py 프로젝트: GLab/ToMaTo
def get_organization_list():
	"""
	get the list of organizations
	:return: list of organizations
	:rtype: list(dict)
	"""
	return get_backend_users_proxy().organization_list()
예제 #5
0
파일: remote_info.py 프로젝트: GLab/ToMaTo
def get_user_list(organization=None, with_flag=None):
	"""
	get the list of users.
	:param str organization: organization filter
	:param str with_flag: flag filter
	:return: user list
	:rtype: list(dict)
	"""
	return get_backend_users_proxy().user_list(organization=organization, with_flag=with_flag)
예제 #6
0
	def _modify(self, attrs):
		orga = None
		if ('organization' in attrs) and (self.get_organization_name() != attrs['organization']):
			orga = self.get_organization_name()
		res = get_backend_users_proxy().user_modify(self.name, attrs)
		if orga is not None:
			get_organization_info(orga).invalidate_info()
			get_organization_info(attrs['organization']).invalidate_info()
		return res
예제 #7
0
파일: remote_info.py 프로젝트: GLab/ToMaTo
	def _modify(self, attrs):
		orga = None
		if ('organization' in attrs) and (self.get_organization_name() != attrs['organization']):
			orga = self.get_organization_name()
		res = get_backend_users_proxy().user_modify(self.name, attrs)
		if orga is not None:
			get_organization_info(orga).invalidate_info()
			get_organization_info(attrs['organization']).invalidate_info()
		return res
예제 #8
0
def get_user_list(organization=None, with_flag=None):
	"""
	get the list of users.
	:param str organization: organization filter
	:param str with_flag: flag filter
	:return: user list
	:rtype: list(dict)
	"""
	return get_backend_users_proxy().user_list(organization=organization, with_flag=with_flag)
예제 #9
0
파일: remote_info.py 프로젝트: GLab/ToMaTo
	def organization_has_role(self, organization, role):
		"""
		check whether the organization has the given role.

		:param str organization: target organization name
		:param str role: maximum role as in auth.permissions.Role
		:return: the role
		:rtype: bool
		"""
		user_list = []
		for user, user_role in self.info()['permissions'].iteritems():
			if topology_role.Role.leq(role,user_role):
				user_list.append(user)

		organizations_with_role = get_backend_users_proxy().organization_list(user_list)

		return (organization in organizations_with_role)
예제 #10
0
	def organization_has_role(self, organization, role):
		"""
		check whether the organization has the given role.

		:param str organization: target organization name
		:param str role: maximum role as in auth.permissions.Role
		:return: the role
		:rtype: bool
		"""
		user_list = []
		for user, user_role in self.info()['permissions'].iteritems():
			if topology_role.Role.leq(role,user_role):
				user_list.append(user)

		organizations_with_role = get_backend_users_proxy().organization_list(user_list)

		return (organization in organizations_with_role)
예제 #11
0
 def create(username, organization, email, password, attrs):
     res = get_backend_users_proxy().user_create(username, organization,
                                                 email, password, attrs)
     get_user_info(username).invalidate_info()
     get_user_list.invalidate()
     return res
예제 #12
0
 def _remove(self):
     get_backend_users_proxy().organization_remove(self.name)
     get_organization_info(self.name).invalidate_info()
예제 #13
0
 def _check_exists(self):
     if self._info is not None:
         return True
     return get_backend_users_proxy().organization_exists(self.name)
예제 #14
0
 def _fetch_info(self, fetch=False):
     return get_backend_users_proxy().user_info(self.name)
예제 #15
0
파일: remote_info.py 프로젝트: GLab/ToMaTo
	def _remove(self):
		orga = self.get_organization_name()
		get_backend_users_proxy().user_remove(self.name)
		get_organization_info(orga).invalidate_info()
예제 #16
0
파일: remote_info.py 프로젝트: GLab/ToMaTo
	def _fetch_info(self, fetch=False):
		return get_backend_users_proxy().user_info(self.name)
예제 #17
0
파일: remote_info.py 프로젝트: GLab/ToMaTo
	def create(username, organization, email, password, attrs):
		res = get_backend_users_proxy().user_create(username, organization, email, password, attrs)
		get_user_info(username).invalidate_info()
		get_user_list.invalidate()
		return res
예제 #18
0
	def _remove(self):
		get_backend_users_proxy().organization_remove(self.name)
예제 #19
0
 def _remove(self):
     orga = self.get_organization_name()
     get_backend_users_proxy().user_remove(self.name)
     get_organization_info(orga).invalidate_info()
예제 #20
0
파일: remote_info.py 프로젝트: GLab/ToMaTo
	def _fetch_info(self, fetch=False):
		return get_backend_users_proxy().organization_info(self.name)
예제 #21
0
 def _fetch_info(self, fetch=False):
     return get_backend_users_proxy().organization_info(self.name)
예제 #22
0
파일: remote_info.py 프로젝트: GLab/ToMaTo
	def _check_exists(self):
		if self._info is not None:
			return True
		return get_backend_users_proxy().organization_exists(self.name)
예제 #23
0
 def _modify(self, attrs):
     return get_backend_users_proxy().organization_modify(self.name, attrs)
예제 #24
0
파일: remote_info.py 프로젝트: GLab/ToMaTo
	def _modify(self, attrs):
		return get_backend_users_proxy().organization_modify(self.name, attrs)
예제 #25
0
파일: remote_info.py 프로젝트: GLab/ToMaTo
	def _remove(self):
		get_backend_users_proxy().organization_remove(self.name)
		get_organization_info(self.name).invalidate_info()
예제 #26
0
	def _remove(self):
		get_backend_users_proxy().organization_remove(self.name)