Socket
Socket
Sign inDemoInstall

@yakj/y407

Package Overview
Dependencies
58
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @yakj/y407

```typescript // 在vue中 this.$store.state.Auth.Rule // 在ts中 store.state.Auth.Rule ``` ### 判断权限 ```typescript // Rule.Cur标识当前企业 /** * 权限对象 */ export default class URule { /** * 用户UID */ UID: number = 0 /** * 企业编号 */ GID: number = 0


Version published
Weekly downloads
1
Maintainers
1
Created
Weekly downloads
 

Readme

Source

权限说明

1、读取用户权限

// 在vue中 
this.$store.state.Auth.Rule
// 在ts中
store.state.Auth.Rule

判断权限

// Rule.Cur标识当前企业
/**
 * 权限对象
 */
export default class URule {
  /**
   * 用户UID
   */
  UID: number = 0
  /**
   * 企业编号
   */
  GID: number = 0
  /**
   * 根企业,即EID=159
   */
  Root = new Admin()
  /**
   * 是否系统管理员
   */
  System: number = 0
  /**
   * 当前企业岗位信息
   */
  Posts: any[] = []
  /**
   * 当前企业组织结构
   */
  Orgs: any[] = []
  /**
   * 服务商标志
   */
  Service = new Admin()
  /**
   * 政府标志
   */
  Gov = new Admin()
  /**
   * 是否是游客,即未加入任何企业
   */
  Tourist = 0
  /**
   * 当前企业权限标志
   */
  Cur = new Admin()
  /**
   * 可切换的企业编号列表
   */
  GIDs: number[] = []
}
/**
 * 管理权限标志
 */
export class Admin {
  /**
   * 管理员标志
   * 1 企业管理员
   * 2 企业部门管理员
   * 3 企业岗位管理员
   */
  Admin = 0
  /**
   * 成员标志
   * 1 成员
   * 0 不是成员
   */
  Member = 0
}

if(rule.Root.Admin){
    //表示时易安空间的管理员,即最高管理权限
}else if(rule.Root.Member){
    //表示时易安空间的工作人员,低于最高管理权限
}else if(rule.Cur.Admin==1){
    //表示时当前企业的最高管理员
}else if(rule.Cur.Admin ==2){
    //表示是当前企业的二级管理员
}else if(rule.Cur.Member){
    //表示是当前企业的成员
}else {
    //表示在当前企业中是游客
}

2、读取当前企业信息

// 在vue中 
this.$store.state.Auth.Enter
// 在ts中
store.state.Auth.Enter


// Enter.Type类型标识为EnterpriseType的枚举值,其他参数同Enterprise对象
export enum EnterpriseType {
    '企业' = 1,
    '服务商' = 2,
    '社区' = 4,
    '政府' = 5
}

3、读取某个企业的信息

get_enterprise_info(EIDs:number[]):Promise<EnterpriseClass>
// 请不要再使用EnterpriseApi.search接口了

4、读取管理的成员列表

get_managed_uids()

5、读取岗位的成员列表

get_posts_members(岗位数组)

Keywords

FAQs

Last updated on 19 Apr 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc