Ejemplo n.º 1
0
        public static ListItem GetListItem(EPermissionType type, bool selected)
        {
            var item = new ListItem(GetText(type), GetValue(type));

            if (selected)
            {
                item.Selected = true;
            }
            return(item);
        }
Ejemplo n.º 2
0
        internal bool HasPermission(Guid viewId, Guid memberId, EPermissionType permissionType)
        {
            List <SqlParameter> paramList = new List <SqlParameter>
            {
                new SqlParameter("@ViewId", viewId),
                new SqlParameter("@MemberId", memberId),
                new SqlParameter("@PermissionId", permissionType.GetHashCode())
            };

            return(base.ExecuteScalar(StoredProcs.VIEW_HAS_PERMISSION, paramList) > 0);
        }
Ejemplo n.º 3
0
 public static bool Equals(EPermissionType type, string typeStr)
 {
     if (string.IsNullOrEmpty(typeStr))
     {
         return(false);
     }
     if (string.Equals(GetValue(type).ToLower(), typeStr.ToLower()))
     {
         return(true);
     }
     return(false);
 }
Ejemplo n.º 4
0
 public static string GetText(EPermissionType type)
 {
     if (type == EPermissionType.GovInteractView)
     {
         return("浏览办件");
     }
     else if (type == EPermissionType.GovInteractAdd)
     {
         return("新增办件");
     }
     else if (type == EPermissionType.GovInteractEdit)
     {
         return("编辑办件");
     }
     else if (type == EPermissionType.GovInteractDelete)
     {
         return("删除办件");
     }
     else if (type == EPermissionType.GovInteractSwitchToTranslate)
     {
         return("转办转移");
     }
     else if (type == EPermissionType.GovInteractComment)
     {
         return("批示办件");
     }
     else if (type == EPermissionType.GovInteractAccept)
     {
         return("受理办件");
     }
     else if (type == EPermissionType.GovInteractReply)
     {
         return("办理办件");
     }
     else if (type == EPermissionType.GovInteractCheck)
     {
         return("审核办件 ");
     }
     throw new Exception();
 }
Ejemplo n.º 5
0
 public static string GetValue(EPermissionType type)
 {
     if (type == EPermissionType.GovInteractView)
     {
         return("View");
     }
     else if (type == EPermissionType.GovInteractAdd)
     {
         return("Add");
     }
     else if (type == EPermissionType.GovInteractEdit)
     {
         return("Edit");
     }
     else if (type == EPermissionType.GovInteractDelete)
     {
         return("Delete");
     }
     else if (type == EPermissionType.GovInteractSwitchToTranslate)
     {
         return("SwitchToTranslate");
     }
     else if (type == EPermissionType.GovInteractComment)
     {
         return("Comment");
     }
     else if (type == EPermissionType.GovInteractAccept)
     {
         return("Accept");
     }
     else if (type == EPermissionType.GovInteractReply)
     {
         return("Reply");
     }
     else if (type == EPermissionType.GovInteractCheck)
     {
         return("Check");
     }
     throw new Exception();
 }
Ejemplo n.º 6
0
        /// <summary>
        /// 新增或更新同步的权限项
        /// </summary>
        /// <param name="funcPermissionData"></param>
        /// <param name="code">权限编码</param>
        /// <param name="name">权限名称</param>
        /// <param name="type">权限类型</param>
        void AddOrUpdateSyncPermission(List <PermissionFunc> funcPermissionData, string code, string name, EPermissionType type)
        {
            var tempPremission = funcPermissionData.FirstOrDefault(d => d.PermissionType == type && d.Code == code);

            if (tempPremission != null)
            {
                if (tempPremission.Name.Equals(name))
                {
                    return;
                }
                tempPremission.Name = name;
                this.Repository.Update(tempPremission);
            }
            else
            {
                tempPremission                = new PermissionFunc();
                tempPremission.ID             = Util.NewID();
                tempPremission.Code           = code;
                tempPremission.Name           = name;
                tempPremission.PermissionType = type;
                tempPremission.IsAvailable    = true;
                this.Repository.Add(tempPremission);
            }
        }
Ejemplo n.º 7
0
 public static bool Equals(string typeStr, EPermissionType type)
 {
     return(Equals(type, typeStr));
 }
Ejemplo n.º 8
0
        /// <summary>
        /// Whether or not the specified role has a certain permission to a particual assetType (instance or def)
        /// </summary>
        /// <param name="roleId">id of the role to check</param>
        /// <param name="assetTypeId">id of the assetType to check</param>
        /// <param name="requestType"></param>
        /// <param name="permission">id of the permission type we are looking for</param>
        /// <returns></returns>
        public bool HasPermission(Guid roleId, Guid assetTypeId, EXObjectRequestType requestType, EPermissionType permission)
        {
            List <SqlParameter> paramList = new List <SqlParameter>();

            paramList.Add(new SqlParameter("@RoleId", roleId));
            paramList.Add(new SqlParameter("@AssetTypeId", assetTypeId));
            paramList.Add(new SqlParameter("@IsInstance", requestType == EXObjectRequestType.Instance));
            paramList.Add(new SqlParameter("@PermissionId", permission.GetHashCode()));

            return(base.ExecuteScalar(StoredProcs.Role_HasPermission, paramList) > 0);
        }