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

通过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

概念 : 过程 : 前台login的更多相关文章

  1. Linux文件系统启动过程及login的实现

    1. busybox简介 busybox是一个集成了一百多个最常用linux命令和工具的软件,它将许多常用的LINUX命令和工具结合到了一个单独的可执行程序中.虽然与相应的GNU工具比较起来,busy ...

  2. 规范 : 过程 : login cookies sessionTimeOut

    规范 用户登入网站将得到一个cookies,如果用户有2个account,各别登入admin page 和 client page,是会得到2个cookies. 在reload page时,后台会得到 ...

  3. 了解 Nginx 基本概念

    前言 本篇是我学习 Nginx 的一些笔记,主要内容讲述了一些了解 Nginx 需要的基本概念.然后探讨一下 Nginx 的模块化的组织架构,以及各个模块的分类.工作方式.职责和提供的相关指令. 主要 ...

  4. I.MX6 busybox set hosname and login with root

    /************************************************************************** * I.MX6 busybox set hosn ...

  5. 了解 : http请求过程

    游览器的请求就是http 请求,在javascript里可以调用.在发http请求时需要 1.header : 通常表明这是什么报头,如:图片是没有报头的.如果是ajax,会是json 2.body ...

  6. linux系统/sbin/init执行过程

    对于Linux的启动过程,之前一直都是研究到内核运行/sbin/init,启动第一个用户进程为止,因为这部分一直都是在内核态工作,所以对于学习内核还是有帮助的,当时/sbin/init之后的过程也需要 ...

  7. 【项目管理】 PMBOK 基础概念 (引论 PMBOK 笔记)

    好紧张, 3月28考试, 全力学 PMP ~~ 一. 项目 1. 项目的定义 项目 : 项目是为创造 独特 的 产品, 服务 或 成果 而进行的 临时性 工作; -- 独特 : 独特性是项目的特征, ...

  8. 面向对象(OOP)基本概念

    面向对象(OOP)基本概念 面向对象编程 —— Object Oriented Programming 简写 OOP 目标 了解 面向对象 基本概念 01. 面向对象基本概念 我们之前学习的编程方式就 ...

  9. Python中面向对象的概念(科普)

    面向对象(OOP)基本概念 面向对象编程 —— Object Oriented Programming 简写 OOP 目标 了解 面向对象 基本概念 01. 面向对象基本概念 我们之前学习的编程方式就 ...

随机推荐

  1. SQL Select结果增加自增自段(网转)

    http://www.cnblogs.com/haver/archive/2011/07/14/2106349.html/* 方法一*/ SELECT 序号= (SELECT COUNT(客户编号) ...

  2. 微软2017MVP大礼包拆箱攻略

    容我本周偷个懒,晒个大礼包就糊弄过去了.13号晚上拿到的大礼包,激动的没敢拆,一直等到娃睡着了,才偷偷打开了快递,忍了两天没忍住,上来晒图得瑟一下,请各位轻拍,谢谢! 1.大礼包的盒子(联邦快递的盒子 ...

  3. chkdsk

    通过 Microsoft 的相关帮助就可以明白,例如对D盘进行操作,则: 示例1:chkdsk /? 显示帮助信息. 示例2:chkdsk d: 检查D盘的磁盘状态,报告磁盘错误. 示例3:chkds ...

  4. 创建TabBar

    -(void)creatTabBarView { NSArray *imgArray=@[]; NSArray *selectImage=@[]; NSArray *names=@[]; for (i ...

  5. STM8S003/005/007芯片解密单片机解密程序提取复制经验分享!

    STM8S003/005/007芯片解密单片机解密程序提取复制 芯片解密型号: STM8S003K3T6,STM8S005K6T6,STM8S007C8T6,STM8S003F3P6 STM8S005 ...

  6. AForge.NET是一个专门为开发者和研究者基于C#框架设计的视频录像

    AForge.NET是一个专门为开发者和研究者基于C#框架设计的,他包括计算机视觉与人工智能,图像处理,神经网络,遗传算法,机器学习,模糊系统,机器人控制等领域.这个框架由一系列的类库组成.主要包括有 ...

  7. 1.3. 创建 Grocery Dude 项目(Core Data 应用程序实践指南)

    该程序功能如下: 分类显示家里各个位置的东西,以此提示该购买哪些生活用品 在超市购买时,告诉某个货品摆在哪条过道旁的货架上 将待买物品按过道编组,这样每个过道只需走一遍,就可以拿完所需货品 通过iCl ...

  8. 使IE6下PNG背景透明的七种方法任你选

    原文地址:http://blog.csdn.net/mosliang/article/details/6760028 相信如何解决png在ie6下透明的问题困扰了很多人.为了追求更好的页面效果,很多人 ...

  9. --@angularJS--一个最简单的指令demo

    <!DOCTYPE HTML><html ng-app="app"><head>    <title>custom-directiv ...

  10. --@angularJS--指令之单个点击展开demo

    1.expander.html: <!DOCTYPE HTML><html ng-app="app"><head>    <title&g ...