public virtual bool Authorize(PermissionRecord permission, EmployeeRole employeeRole) { return Authorize(permission.SystemName, employeeRole); }
/// <summary> /// Authorize permission /// </summary> /// <param name="permissionRecordSystemName">Permission record system name</param> /// <param name="employeeRole">Customer role</param> /// <returns>true - authorized; otherwise, false</returns> protected virtual bool Authorize(string permissionRecordSystemName, EmployeeRole employeeRole) { if (String.IsNullOrEmpty(permissionRecordSystemName)) return false; string key = string.Format(PERMISSIONS_ALLOWED_KEY, employeeRole.Id, permissionRecordSystemName); foreach (var permission1 in employeeRole.PermissionRecords) if (permission1.SystemName.Equals(permissionRecordSystemName, StringComparison.InvariantCultureIgnoreCase)) return true; return false; }