Esempio n. 1
0
def is_user_authorized_to_delete_layout(request, username, layout_id):
    is_authorized = False

    layout = db.get_layout_by_id(request.db_session, layout_id)

    if layout is not None:  # Layout doesnt exists
        if layout.owner_email == username:
            is_authorized = True

    return is_authorized
Esempio n. 2
0
def is_user_authorized_to_delete_layout(request, username, layout_id):
	is_authorized = False

	layout = db.get_layout_by_id(request.db_session, layout_id)

	if layout is not None:  # Layout doesnt exists
		if layout.owner_email == username:
			is_authorized = True

	return is_authorized
Esempio n. 3
0
def is_user_authorized_to_view_layout(request, username, layout_id):
	is_authorized = False

	layout = db.get_layout_by_id(request.db_session, layout_id)

	if layout is not None:  # Layout doesnt exists
		if layout.owner_email == username:
			is_authorized = True
		elif layout.is_shared == 1:  # layout is shared
			if get_graph_by_id(request, layout.graph_id).is_public == 1:
				is_authorized = True
			else:
				for group in layout.graph.groups:
					if users.controllers.is_member_of_group(request, username, group.id):
						is_authorized = True  # layout is shared with the user

	return is_authorized
Esempio n. 4
0
def is_user_authorized_to_view_layout(request, username, layout_id):
	is_authorized = False

	layout = db.get_layout_by_id(request.db_session, layout_id)

	if layout is not None:  # Layout doesnt exists
		if layout.owner_email == username:
			is_authorized = True
		elif layout.is_shared == 1:  # layout is shared
			if get_graph_by_id(request, layout.graph_id).is_public == 1:
				is_authorized = True
			else:
				for group in layout.graph.groups:
					if users.controllers.is_member_of_group(request, username, group.id):
						is_authorized = True  # layout is shared with the user

	return is_authorized
Esempio n. 5
0
def get_layout_by_id(request, layout_id):
    return db.get_layout_by_id(request.db_session, layout_id)
Esempio n. 6
0
def get_layout_by_id(request, layout_id):
	return db.get_layout_by_id(request.db_session, layout_id)