private SharedPermissionCollection sharedPermissions; //共享的权限子集

        #endregion Fields

        #region Constructors

        public XcrmPermissionCollection(IXcrmPrincipal principal)
        {
            this.role = principal.Role ?? Role.EMPTY_ROLE;
            this.managedUserGroup = principal.ManagedUserGroup;
            string p = "/";
            if (principal.Org != null)
            {
                p = principal.Org.Path.EndsWith("/") ? principal.Org.Path : principal.Org.Path + "/";
            }
            this.selfPermission = new OrgPermission(principal.IsAdmin ? p + "**/*" : p + principal.Name + "/**/*");
            this.sharedPermissions = SharedPermissionCollection.GetSharedPermissionCollection(principal);
        }
 public static SharedPermissionCollection GetSharedPermissionCollection(IXcrmPrincipal sharedTargetPrincipal)
 {
     return new SharedPermissionCollection(sharedTargetPrincipal);
 }
Exemplo n.º 3
0
 public ManagedUserGroup(IXcrmPrincipal owner)
 {
     CheckNullArg(owner);
     this.owner = owner;
 }
 /// <summary>
 /// 构造共享权限集
 /// </summary>
 /// <param name="sharedTargetPrincipal">
 /// 共享目标身份表示将某个权限共享给的身份目标,例如:在模块X下,将B角色共享给A角色,
 /// 则A角色即为杯共享的目标身份
 /// </param>
 private SharedPermissionCollection(IXcrmPrincipal sharedTargetPrincipal)
 {
     this.sharedTargetPrincipal = sharedTargetPrincipal;
 }
Exemplo n.º 5
0
 /// <summary>
 /// 添加可管理的帐号身份
 /// </summary>
 /// <param name="principal"></param>
 public void AddManagedPrincipal(IXcrmPrincipal principal)
 {
     CheckNullArg(principal);
     if (managedPrincipals.ContainsKey(principal.Name))
     {
         Logger.Error("帐号[" + principal.Name + "] 已经存在! 你不能添加相同的帐号身份到同一个可管理用户组中!");
         throw new ArgumentException("the org[" + principal.Name + "] exists!");
     }
     managedPrincipals.Add(principal.Name, principal);
 }