zoukankan      html  css  js  c++  java
  • 概念 : 过程 : 前台login

    为了解决自动登入、访问权限机制、登入权限而诞生了这过程,过程需要概念来维护记忆。

    通过singlePageAutoLoginLocalStorage, UIStateLocalStorage, User, 这3个对象是过程中会用到的

    singlePageAutoLoginLocalStorage : {
        accountId : 5,
        singlePage : "employer"
    }
    
    UIStateRoleSelectedLocalStorage : {
        accountId : 5,
        singlePage : "employer",
        accountRole : "customer",
        stateUrl : "a/b/c"
    }
    
    user : {
        account : {},
        role : "",
        account : []
    }

    一个部分是负责auto login,另一个部分是负责page permission

    过程:auto login

    Hdlogin 把对象放去 rootscope.user

    remove singlePageAutoLoginStorage data if user.accounts no match

    match current single page & singlePageAutoLoginStorage for auto login

      if match, fill user.account (no fill account.user.role)

      if no, got callback(project'logic)

        if yes, return

          true, fill user.account, set singlePageAutoLoginStorage (no fill account.user.role)

          false, normal process

        if no, normal process

    过程:page permission

    setup the permission for every UIState, which is callback

      1. getUsaAccountTypeNames

      2. getSaRolesName

      3. redirectLoginUrl

      4. redirectSwitchUrl

         5. redirectToNoRolePermission

    if user.account == undefined 

      if yes, redirectLoginUrl

      if no, check getUsaAccountTypeNames contain user.account.type

        if no, redirectLoginUrl

        if yes, process

        

    filter pagePermissionRoles with user.account.roles (filter way is check every permissionRole got accountRole then keep, other remove)

      if pagePermissionRoles length == 0

        alert("your account roles is not allowed visit") > redirectToNoRolePermission

      if pagePermissionRoles.length > 0

        pagePermissionRoles contain UIStateRoleSelectedLocalStorage

          if yes, fill user.role

          if no, pagePermissionRoles.length == 1 ?

            if yes, fill user.role

            if no, pagePermissionRoles contain user.role ?

              if yes, fill user.role

              if no, redirectSwitchUrl

    过程:login page

    state.get(param) for the return url permission(mean success will redirect to returnUrl), the param come to url.

    login page will show a select option for user select a accountType, this will let user know what the page need and ajax header need a selectedAccountType

    succesfull will update the user.account and user.role

    过程:logout

    if auto login got project'logic, then logout also got project'logic, which is logout need clear all singlePageAutoLoginStorage or clear current singlePageAutoLoginStorage

  • 相关阅读:
    mongodb集群搭建
    ansible 部署redis集群(三台主机6节点3主3备)
    nginx upstream bug
    回炉重造之 nginx
    docker 搭建jenkins环境
    搭建gitlab
    Dockerfile传入变量问题
    mysql8忘记root密码重置密码
    docker-compose容器化构建nginx服务
    docker-compose容器化构建minio服务
  • 原文地址:https://www.cnblogs.com/stooges/p/4888366.html
Copyright © 2011-2022 走看看