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

  • 相关阅读:
    kuryr环境搭建
    使用docker搭建kafka环境
    记一次解决curl https证书问题
    一篇精彩的洗地文
    个人知识管理利器wiz
    Markdown写作
    用Bottle开发web程序(二)
    用Bottle开发web程序(一)
    Magnum Kubernetes源码分析(二)
    DVWA(九):File Upload 全等级文件上传
  • 原文地址:https://www.cnblogs.com/stooges/p/4888366.html
Copyright © 2011-2022 走看看