示例#1
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
示例#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
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
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
	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
	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
	def _remove(self):
		orga = self.get_organization_name()
		get_backend_users_proxy().user_remove(self.name)
		get_organization_info(orga).invalidate_info()
示例#16
0
	def _fetch_info(self, fetch=False):
		return get_backend_users_proxy().user_info(self.name)
示例#17
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
示例#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
	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
	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
	def _modify(self, attrs):
		return get_backend_users_proxy().organization_modify(self.name, attrs)
示例#25
0
	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)