def topredirection(request): """Simple view to redirect the request when no application is specified The default "top redirection" can be specified in the *Admin > Settings* panel. It is the application that will be launched by default. Users that are not allowed to access this application will be redirected to the "User preferences" application. :param request: a Request object """ from modoboa.lib import parameters from modoboa.core.extensions import exts_pool topredir = parameters.get_admin("DEFAULT_TOP_REDIRECTION", app="core") if not topredir in ["core"]: infos = exts_pool.get_extension_infos(topredir) path = infos["url"] if infos["url"] else infos["name"] else: path = "admin" # topredir if topredir in ["core", "stats"] and \ request.user.belongs_to_group('SimpleUsers'): path = "userprefs" return HttpResponseRedirect(path)
def topredirection(request): """Simple view to redirect the request when no application is specified. The default "top redirection" can be specified in the *Admin > Settings* panel. It is the application that will be launched. Those not allowed to access the application will be redirected to their preferences page. This feature only applies to simple users. :param request: a Request object """ from modoboa.lib import parameters from modoboa.core.extensions import exts_pool if request.user.group == 'SimpleUsers': topredir = parameters.get_admin("DEFAULT_TOP_REDIRECTION", app="core") if topredir != "user": infos = exts_pool.get_extension_infos(topredir) path = infos["url"] if infos["url"] else infos["name"] else: path = reverse("core:user_index") else: # FIXME path = reverse("admin:domain_list") return HttpResponseRedirect(path)
def topredirection(request): """Simple view to redirect the request when no application is specified. The default "top redirection" can be specified in the *Admin > Settings* panel. It is the application that will be launched. Those not allowed to access the application will be redirected to their preferences page. This feature only applies to simple users. :param request: a Request object """ from modoboa.lib import parameters from modoboa.core.extensions import exts_pool if request.user.group == 'SimpleUsers': topredir = parameters.get_admin("DEFAULT_TOP_REDIRECTION", app="core") if topredir != "user": infos = exts_pool.get_extension_infos(topredir) path = infos["url"] if infos["url"] else infos["name"] else: path = reverse("core:user_index") else: # FIXME path = reverse("modoboa_admin:domain_list") return HttpResponseRedirect(path)