コード例 #1
0
ファイル: PermissionService.cs プロジェクト: zraja90/MyApps
 public virtual bool Authorize(PermissionRecord permission, CustomerRole customerRole)
 {
     return Authorize(permission.SystemName, customerRole);
 }
コード例 #2
0
ファイル: PermissionService.cs プロジェクト: zraja90/MyApps
        /// <summary>
        /// Authorize permission
        /// </summary>
        /// <param name="permissionRecordSystemName">Permission record system name</param>
        /// <param name="customerRole">Customer role</param>
        /// <returns>true - authorized; otherwise, false</returns>
        protected virtual bool Authorize(string permissionRecordSystemName, CustomerRole customerRole)
        {
            if (String.IsNullOrEmpty(permissionRecordSystemName))
                return false;

            string key = string.Format(PERMISSIONS_ALLOWED_KEY, customerRole.Id, permissionRecordSystemName);
            foreach (var permission1 in customerRole.PermissionRecords)
                    if (permission1.SystemName.Equals(permissionRecordSystemName, StringComparison.InvariantCultureIgnoreCase))
                        return true;

                return false;
        }